Path: redb-route/tests/redb.Route.Tests.Xml/XmlContainerAndLoadingTests.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/XmlContainerAndLoadingTests.cs
----
using System.Xml.Linq;
using AwesomeAssertions;
using redb.Route.Abstractions;
using redb.Route.Core;
using redb.Route.Xml;
namespace redb.Route.Tests.Xml;
///
/// Container batch: handlers on <routes> for every route of the file, the
/// extension channel exercised from outside the core, expression-escaping equivalence and
/// the glob loading overload.
///
public class XmlContainerAndLoadingTests : IAsyncLifetime
{
private readonly RouteContext _context = new();
public Task InitializeAsync() => Task.CompletedTask;
public async Task DisposeAsync()
{
await _context.DisposeAsync();
GC.SuppressFinalize(this);
}
private async Task StartAndProducer(string fromUri)
{
await _context.Start();
var producer = _context.GetEndpoint(fromUri).CreateProducer();
await producer.Start();
return producer;
}
// ── container-level handlers ─────────────────────────────────────────────
[Fact]
public async Task ContainerOnException_AppliesToEveryRouteOfTheFile()
{
_context.AddXmlRoutesFromContent("""
""");
await _context.Start();
var producerA = _context.GetEndpoint("direct://cont-a-in").CreateProducer();
var producerB = _context.GetEndpoint("direct://cont-b-in").CreateProducer();
await producerA.Start();
await producerB.Start();
var a = new Exchange(new Message("x"));
await producerA.Process(a);
var b = new Exchange(new Message("x"));
await producerB.Process(b);
a.In.Headers["rescued"].Should().Be("yes");
b.In.Headers["rescued"].Should().Be("yes");
}
[Fact]
public async Task ContainerIntercept_RunsForEveryRouteOfTheFile()
{
var seen = new List