Path: redb-route/tests/redb.Route.Tests/Definitions/ProcessorDefinitionTests.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/Definitions/ProcessorDefinitionTests.cs
----
using AwesomeAssertions;
using redb.Route.Core;
using redb.Route.Definitions;
using redb.Route.Processors;
namespace redb.Route.Tests.Definitions;
///
/// Tests for W5 ProcessorDefinition migration: F0-F1 foundations.
///
public class ProcessorDefinitionTests : IAsyncLifetime
{
private readonly RouteContext _context = new();
public Task InitializeAsync() => Task.CompletedTask;
public async Task DisposeAsync()
{
await _context.DisposeAsync();
GC.SuppressFinalize(this);
}
[Fact]
public void ToDefinition_CompilesToToProcessor()
{
var def = new ToDefinition("direct:target");
var proc = def.CreateProcessor(_context);
proc.Should().BeOfType();
((ToProcessor)proc).EndpointUri.Should().Be("direct:target");
}
[Fact]
public void ProcessorDefinition_AddOutput_SetsParent()
{
var parent = new ToDefinition("direct:a");
var child = new ToDefinition("direct:b");
// ProcessorDefinition.AddOutput is protected, so test through RouteDefinition once it exists.
// For now verify the interface contract manually.
child.Parent = parent;
child.Parent.Should().BeSameAs(parent);
}
}