Path: redb-route/tests/redb.Route.Tests.Xml/MarkedReferenceGateTests.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/MarkedReferenceGateTests.cs ---- using AwesomeAssertions; using redb.Route.Core; using redb.Route.Xml; using redb.Route.Xml.Packaging; namespace redb.Route.Tests.Xml; /// /// Row 7 part 2: an option marked [RegistryReference] names a registry object bare as well as with #, in /// the URI form and in the structured form, so a name no <bean> declares is the usual undeclared-reference /// warning. The core's options are known without --bin; a connector's come with its catalog. A value built from /// configuration or an expression is left alone, and a bare value of an unmarked option is still text. /// public sealed class MarkedReferenceGateTests : IDisposable { private readonly string _root = Path.Combine(Path.GetTempPath(), "redb-xml-marked-" + Guid.NewGuid().ToString("N")); public MarkedReferenceGateTests() => Directory.CreateDirectory(_root); public void Dispose() => Directory.Delete(_root, recursive: true); private static readonly IReadOnlyList Catalog = ComponentCatalog.Build([new ProbeRefComponent()]); private static string T() => $"{typeof(TType).FullName}, {typeof(TType).Assembly.GetName().Name}"; private PackageResult Check(string steps, string beans = "", IReadOnlyList? catalog = null) { var dir = RouteProjectScaffold.Create(_root, "Mrk" + Guid.NewGuid().ToString("N")[..6]); File.WriteAllText(Path.Combine(dir, "routes", "main.route.xml"), $""" {beans} {steps} """); return RoutePackage.Check(dir, "p", "1.0.0", catalog: catalog); } private static IEnumerable Undeclared(PackageResult result) => result.Warnings.Select(w => w.Message).Where(m => m.Contains("is not declared by any ", StringComparison.Ordinal)); [Fact] public void ABareNameInACoreMarkedOption_IsAReference_WithoutBin() { Undeclared(Check("""""")) .Should().ContainSingle().Which.Should().StartWith("'#filter' is not declared by any of this package"); } [Fact] public void ABareNameDeclaredByABean_Passes() { Undeclared(Check("""""", $"""""")) .Should().BeEmpty(); } [Fact] public void AHashName_IsReadAsBefore_Once() { Undeclared(Check("""""")).Should().ContainSingle(); } [Theory] [InlineData("""""")] [InlineData("""""")] [InlineData("""""")] public void PlaceholdersAndUnmarkedOptions_AreLeftAlone(string step) { Undeclared(Check(step)).Should().BeEmpty(); } [Fact] public void AConnectorsMarkedOption_IsAReference_WithItsCatalog_InTheUriForm() { Undeclared(Check("""""", catalog: Catalog)) .Should().ContainSingle().Which.Should().StartWith("'#main' is not declared"); } [Fact] public void AConnectorsMarkedOption_IsAReference_WithItsCatalog_InTheStructuredForm() { Undeclared(Check("""""", catalog: Catalog)) .Should().BeEquivalentTo( "'#main' is not declared by any of this package — either module code registers it at startup (fine), or it is a dangling reference.", "'#other' is not declared by any of this package — either module code registers it at startup (fine), or it is a dangling reference."); } [Fact] public void WithoutItsCatalog_AConnectorsBareName_IsNotKnown() { Undeclared(Check("""""")).Should().BeEmpty(); } }