Path: redb-route/tests/redb.Route.Tests/Core/PropertyPlaceholderIntegrationTests.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/Core/PropertyPlaceholderIntegrationTests.cs ---- using AwesomeAssertions; using Microsoft.Extensions.Configuration; using redb.Route.Abstractions; using redb.Route.Core; namespace redb.Route.Tests.Core; /// /// End-to-end tests for property placeholders through the full DSL → Compiler → Engine pipeline: /// a live route whose From and To URIs carry {{key}} placeholders, started and /// driven with a real message, asserting the message actually reaches the resolved destination. /// Values are drawn from IConfiguration, context properties and inline defaults. /// public class PropertyPlaceholderIntegrationTests : IAsyncLifetime { private readonly RouteContext _context = new(); public Task InitializeAsync() => Task.CompletedTask; public async Task DisposeAsync() { await _context.DisposeAsync(); GC.SuppressFinalize(this); } private async Task StartAndGetProducer(string fromUri) { await _context.Start(); var producer = _context.GetEndpoint(fromUri).CreateProducer(); await producer.Start(); return producer; } [Fact] public async Task Placeholders_InFromAndTo_FromConfiguration_DeliverEndToEnd() { IConfiguration config = new ConfigurationBuilder() .AddInMemoryCollection(new Dictionary { ["orders.source"] = "direct://cfg-in", ["orders.dest"] = "direct://cfg-out", }) .Build(); _context.AddService(typeof(IConfiguration), config); var received = new List(); _context.AddRoutes(r => { r.From("direct://cfg-out").Process(e => received.Add(e.In.Body?.ToString())); // Both endpoints of the working route are placeholders resolved from IConfiguration. r.From("{{orders.source}}").To("{{orders.dest}}"); }); // The consumer is reachable through the resolved literal URI — proof the placeholder From bound it. var producer = await StartAndGetProducer("direct://cfg-in"); await producer.Process(new Exchange(new Message("order-42"))); received.Should().ContainSingle().Which.Should().Be("order-42"); } [Fact] public async Task Placeholder_DefaultValue_UsedInLiveRoute() { var received = new List(); _context.AddRoutes(r => { r.From("direct://def-out").Process(e => received.Add(e.In.Body?.ToString())); // The key is not configured anywhere → the inline default drives the destination. r.From("direct://def-in").To("direct://{{unset.dest:def-out}}"); }); var producer = await StartAndGetProducer("direct://def-in"); await producer.Process(new Exchange(new Message("payload"))); received.Should().ContainSingle().Which.Should().Be("payload"); } [Fact] public async Task Placeholder_FromContextProperty_DeliversEndToEnd() { // Container-free path: values come from context.SetProperty, no IConfiguration registered. _context.SetProperty("dest.queue", "prop-out"); var received = new List(); _context.AddRoutes(r => { r.From("direct://prop-out").Process(e => received.Add(e.In.Body?.ToString())); r.From("direct://prop-in").To("direct://{{dest.queue}}"); }); var producer = await StartAndGetProducer("direct://prop-in"); await producer.Process(new Exchange(new Message("hi"))); received.Should().ContainSingle().Which.Should().Be("hi"); } }