Path: redb-route/tests/redb.Route.Tests.Xml/XmlHeaderFilterStrategyBeanTests.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests.Xml/XmlHeaderFilterStrategyBeanTests.cs ---- using AwesomeAssertions; using redb.Route.Abstractions; using redb.Route.Core; using redb.Route.Xml; namespace redb.Route.Tests.Xml; /// /// A header filter strategy declared in markup: is a plain bean whose name /// lists are filled from <list>, and an endpoint's headerFilterStrategy=#name finds it. /// public class XmlHeaderFilterStrategyBeanTests : IAsyncLifetime { private readonly RouteContext _context = new(); public Task InitializeAsync() => Task.CompletedTask; public async Task DisposeAsync() { await _context.DisposeAsync(); GC.SuppressFinalize(this); } private static string T() => $"{typeof(TType).FullName}, {typeof(TType).Assembly.GetName().Name}"; [Fact] public void AWhitelistDeclaredInMarkup_IsBuiltAndFoundByAnEndpoint() { _context.AddXmlContextFromContent($""" Correlation-IDtraceparent """); var strategy = _context.GetFromRegistry("correlationOnly")!; var exchange = new Exchange(new Message("body")); strategy.FilterOutgoing("Correlation-ID", "c-42", exchange).Should().BeFalse("a listed header goes out"); strategy.FilterOutgoing("correlation-id", "c-42", exchange).Should().BeFalse("names match case-insensitively"); strategy.FilterOutgoing("Authorization", "Bearer x", exchange).Should().BeTrue("anything else stays back"); var act = () => _context.GetEndpoint("vm://xml-strategy?headerFilterStrategy=#correlationOnly").CreateProducer(); act.Should().NotThrow("the endpoint resolves the bean declared in markup"); } [Fact] public void TheGenerator_CarriesTheBeanAndTheOptionIntoCSharp() { var document = System.Xml.Linq.XDocument.Parse($""" Correlation-ID """); var code = XmlCodeGenerator.Generate(document, "StrategyGenerated", "Tests.Generated"); code.Should().Contain($"XmlBeans.Create(Context!, \"{T()}\"") .And.Contain("(\"OutFilter\", XmlBeans.List(Context!, null, [\"Correlation-ID\"]))") .And.Contain("(\"FilterOnMatch\", \"false\")") .And.Contain("vm://out?headerFilterStrategy=#correlationOnly"); } }