Bundle: redb-route / tests/redb.Route.Validation.Adapters.Tests (tests.redb.Route.Validation.Adapters.Tests.txt), 4 files Snapshot: 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 Index: https://redbase.app/src/dev-2026-12-06/redb-route/_index.txt ==== Path: redb-route/tests/redb.Route.Validation.Adapters.Tests/DataAnnotationsValidatorTests.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.Validation.Adapters.Tests/DataAnnotationsValidatorTests.cs ---- using System.ComponentModel.DataAnnotations; using AwesomeAssertions; using redb.Route.Abstractions; using redb.Route.Core; using redb.Route.Validation; using Xunit; namespace redb.Route.Validation.Adapters.Tests; public class DataAnnotationsValidatorTests { public sealed class Order { [Required] public string CustomerId { get; set; } = ""; [Range(1, int.MaxValue, ErrorMessage = "Quantity must be positive")] public int Quantity { get; set; } } private static IExchange Exchange(object? body) => new Exchange(new Message(body)); [Fact] public void Valid_ReturnsSuccess() { var v = new DataAnnotationsValidator(); var r = v.Validate(Exchange(new Order { CustomerId = "C1", Quantity = 5 })); r.IsValid.Should().BeTrue(); } [Fact] public void Invalid_ReturnsFailureWithMemberNames() { var v = new DataAnnotationsValidator(); var r = v.Validate(Exchange(new Order { CustomerId = "", Quantity = 0 })); r.IsValid.Should().BeFalse(); r.Errors.Should().Contain(e => e.Contains("CustomerId")); r.Errors.Should().Contain(e => e.Contains("Quantity")); } [Fact] public void DefaultSeverity_IsError() { var v = new DataAnnotationsValidator(); var r = v.Validate(Exchange(new Order())); r.Severity.Should().Be(ValidationSeverity.Error); } [Fact] public void WarningSeverity_IsPropagated() { var v = new DataAnnotationsValidator(ValidationSeverity.Warning); var r = v.Validate(Exchange(new Order())); r.Severity.Should().Be(ValidationSeverity.Warning); } [Fact] public void NullBody_ReturnsFailure() { var v = new DataAnnotationsValidator(); var r = v.Validate(Exchange(null)); r.IsValid.Should().BeFalse(); r.Errors.Should().ContainSingle().Which.Should().Contain("null"); } } Path: redb-route/tests/redb.Route.Validation.Adapters.Tests/FluentValidationMessageValidatorTests.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.Validation.Adapters.Tests/FluentValidationMessageValidatorTests.cs ---- using AwesomeAssertions; using FluentValidation; using redb.Route.Abstractions; using redb.Route.Core; using redb.Route.Validation; using Xunit; namespace redb.Route.Validation.Adapters.Tests; public class FluentValidationMessageValidatorTests { public sealed class Person { public string Name { get; set; } = ""; public int Age { get; set; } } public sealed class PersonValidator : AbstractValidator { public PersonValidator() { RuleFor(p => p.Name).NotEmpty(); RuleFor(p => p.Age).GreaterThan(0); } } private static IExchange Exchange(object? body) => new Exchange(new Message(body)); [Fact] public void Valid_ReturnsSuccess() { var v = new FluentValidationMessageValidator(new PersonValidator()); var r = v.Validate(Exchange(new Person { Name = "John", Age = 30 })); r.IsValid.Should().BeTrue(); } [Fact] public void Invalid_ReturnsFailureWithErrors() { var v = new FluentValidationMessageValidator(new PersonValidator()); var r = v.Validate(Exchange(new Person { Name = "", Age = 0 })); r.IsValid.Should().BeFalse(); r.Errors.Should().HaveCount(2); r.Errors.Should().Contain(e => e.Contains("Name")); r.Errors.Should().Contain(e => e.Contains("Age")); } [Fact] public void DefaultSeverity_IsError() { var v = new FluentValidationMessageValidator(new PersonValidator()); var r = v.Validate(Exchange(new Person())); r.Severity.Should().Be(ValidationSeverity.Error); } [Fact] public void WarningSeverity_IsPropagated() { var v = new FluentValidationMessageValidator(new PersonValidator(), ValidationSeverity.Warning); var r = v.Validate(Exchange(new Person())); r.Severity.Should().Be(ValidationSeverity.Warning); } [Fact] public void NullBody_ReturnsFailure() { var v = new FluentValidationMessageValidator(new PersonValidator()); var r = v.Validate(Exchange(null)); r.IsValid.Should().BeFalse(); r.Errors.Should().ContainSingle().Which.Should().Contain("null"); } [Fact] public void IncompatibleBody_ReturnsFailure() { var v = new FluentValidationMessageValidator(new PersonValidator()); var r = v.Validate(Exchange("just a string")); r.IsValid.Should().BeFalse(); r.Errors.Should().ContainSingle().Which.Should().Contain("not assignable"); } [Fact] public void Constructor_NullValidator_Throws() { var act = () => new FluentValidationMessageValidator(null!); act.Should().Throw(); } } Path: redb-route/tests/redb.Route.Validation.Adapters.Tests/ValidationDslExtensionsTests.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.Validation.Adapters.Tests/ValidationDslExtensionsTests.cs ---- using AwesomeAssertions; using FluentValidation; using redb.Route.Core; using redb.Route.Validation; using Xunit; namespace redb.Route.Validation.Adapters.Tests; public class ValidationDslExtensionsTests { public sealed class Item { public string Name { get; set; } = ""; } private sealed class ItemValidator : AbstractValidator { public ItemValidator() => RuleFor(x => x.Name).NotEmpty(); } [Fact] public async Task ValidateFluent_Error_ThrowsByDefault() { await using var ctx = new RouteContext(); ctx.AddRoutes(r => { r.From("direct://fv-error") .ValidateFluent(new ItemValidator()) .Process(_ => { }); }); await ctx.Start(); var producer = ctx.GetEndpoint("direct://fv-error").CreateProducer(); await producer.Start(); var act = async () => await producer.Process(new Exchange(new Message(new Item()))); await act.Should().ThrowAsync(); } [Fact] public async Task ValidateFluent_Warning_DoesNotThrow_AndSetsHeader() { await using var ctx = new RouteContext(); Exchange? captured = null; ctx.AddRoutes(r => { r.From("direct://fv-warn") .ValidateFluent(new ItemValidator(), ValidationSeverity.Warning) .Process(e => captured = (Exchange)e); }); await ctx.Start(); var producer = ctx.GetEndpoint("direct://fv-warn").CreateProducer(); await producer.Start(); await producer.Process(new Exchange(new Message(new Item()))); captured.Should().NotBeNull(); captured!.In.Headers.Should().ContainKey(ValidateProcessor.ValidationWarningsHeader); } [Fact] public async Task ValidateAnnotations_Warning_DoesNotThrow() { await using var ctx = new RouteContext(); ctx.AddRoutes(r => { r.From("direct://da-warn") .ValidateAnnotations(ValidationSeverity.Warning) .Process(_ => { }); }); await ctx.Start(); var producer = ctx.GetEndpoint("direct://da-warn").CreateProducer(); await producer.Start(); var act = async () => await producer.Process( new Exchange(new Message(new FluentValidationMessageValidatorTests.Person()))); await act.Should().NotThrowAsync(); } } Path: redb-route/tests/redb.Route.Validation.Adapters.Tests/redb.Route.Validation.Adapters.Tests.csproj 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.Validation.Adapters.Tests/redb.Route.Validation.Adapters.Tests.csproj ---- false false