Path: redb-route/tests/redb.Route.Tests/Expressions/DottedPropertyNameTests.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/Expressions/DottedPropertyNameTests.cs ---- using AwesomeAssertions; using redb.Route.Abstractions; using redb.Route.Core; using redb.Route.Expressions; namespace redb.Route.Tests.Expressions; /// /// A property whose name contains a dot (omni.PollInterval, the shape a module uses to /// namespace its settings). Reported 2026-09-24: written bare — property.omni.PollInterval in /// a delay or a setProperty — it read as empty, while the same name inside /// ${...}, in a comparison, and any dotted header resolved fine. The bare value path /// went straight to nested access, so it looked for a property named omni and a member /// PollInterval on it; every other path asks for the literal name first. /// [Collection("ExpressionResolver")] public class DottedPropertyNameTests : IDisposable { public DottedPropertyNameTests() => ExpressionResolver.ClearAllCaches(); public void Dispose() { ExpressionResolver.ClearAllCaches(); GC.SuppressFinalize(this); } private static IExchange WithProperty(string name, object? value) { var exchange = new Exchange(new Message("body")); exchange.Properties[name] = value; return exchange; } private sealed class Settings { public int PollInterval { get; set; } } [Fact] public void A_bare_expression_reads_a_property_whose_name_holds_a_dot() { var exchange = WithProperty("omni.PollInterval", 5000); new StringExpression("property.omni.PollInterval").Evaluate(exchange).Should().Be(5000); } [Fact] public void The_template_form_reads_the_same_property() { var exchange = WithProperty("omni.PollInterval", 5000); // Already worked — kept so the two forms are asserted side by side and stay in step. new StringExpression("${property.omni.PollInterval}").Evaluate(exchange).Should().Be("5000"); } [Fact] public void A_nested_member_is_still_read_when_no_property_carries_the_literal_name() { var exchange = WithProperty("omni", new Settings { PollInterval = 700 }); new StringExpression("property.omni.PollInterval").Evaluate(exchange).Should().Be(700); } [Fact] public void The_literal_name_wins_over_a_nested_member_of_the_same_shape() { var exchange = WithProperty("omni", new Settings { PollInterval = 700 }); exchange.Properties["omni.PollInterval"] = 5000; // The rule the smart resolver has always followed for headers and for templates: a property // written with that exact name is what the author meant. new StringExpression("property.omni.PollInterval").Evaluate(exchange).Should().Be(5000); } [Fact] public void A_name_that_matches_nothing_is_null_rather_than_a_throw() { var exchange = WithProperty("other", 1); new StringExpression("property.omni.PollInterval").Evaluate(exchange).Should().BeNull(); } [Fact] public void A_dotted_header_keeps_reading_the_literal_name() { var exchange = new Exchange(new Message("body")); exchange.In.Headers["omni.PollInterval"] = 5000; new StringExpression("header.omni.PollInterval").Evaluate(exchange).Should().Be(5000); } }