Path: redb-route/tests/redb.Route.Tests/Batching/BatchOptionsTests.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/Batching/BatchOptionsTests.cs ---- using AwesomeAssertions; using redb.Route.Batching; namespace redb.Route.Tests.Batching; /// The batch options of an endpoint: batch mode only by batching=true, start failures named. public class BatchOptionsTests { [Fact] public void Resolve_BatchingOff_NoOptions_IsNull() { BatchOptions.Resolve("kafka:orders", batching: false, maxBatchMessages: null, pollTimeoutMs: 1000, batchingIntervalMs: null, defaultMaxBatchMessages: 500).Should().BeNull(); } [Theory] [InlineData(10, null, "maxBatchMessages")] [InlineData(null, 2000, "batchingIntervalMs")] public void Resolve_BatchOptionWithoutBatching_FailsTheStart(int? max, int? interval, string option) { var act = () => BatchOptions.Resolve("kafka:orders", false, max, 1000, interval, 500); act.Should().Throw() .WithMessage($"*kafka:orders*{option}*batching=true*"); } [Fact] public void Resolve_BatchingOn_AppliesTheConnectorDefault() { var options = BatchOptions.Resolve("kafka:orders", true, null, 1000, null, 500)!; options.MaxMessages.Should().Be(500); options.PollTimeout.Should().Be(TimeSpan.FromSeconds(1)); options.Interval.Should().BeNull(); } [Fact] public void Resolve_BatchingOn_TakesTheOptions() { var options = BatchOptions.Resolve("kafka:orders", true, 20, 300, 5000, 500)!; options.MaxMessages.Should().Be(20); options.PollTimeout.Should().Be(TimeSpan.FromMilliseconds(300)); options.Interval.Should().Be(TimeSpan.FromSeconds(5)); } [Theory] [InlineData(0, 1000, null, "maxBatchMessages")] [InlineData(10, 0, null, "pollTimeoutMs")] [InlineData(10, 1000, 0, "batchingIntervalMs")] public void Resolve_ValueOutOfRange_FailsTheStart_NamingTheEndpoint(int max, int poll, int? interval, string option) { var act = () => BatchOptions.Resolve("rabbitmq:orders", true, max, poll, interval, 500); act.Should().Throw().WithMessage($"*rabbitmq:orders*{option}*"); } }