Path: redb-route/tests/redb.Route.Tests.IbmMq/IbmMqBatchStartTests.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.IbmMq/IbmMqBatchStartTests.cs
----
using redb.Route.Core;
using redb.Route.IbmMq;
namespace redb.Route.Tests.IbmMq;
/// IBM MQ batch options: resolved when the endpoint is created; each configuration that cannot work refused.
public sealed class IbmMqBatchStartTests
{
private const string Base = "host=localhost&port=1414&channel=DEV.APP.SVRCONN&queueManager=QM1";
private static IbmMqEndpoint Create(string query)
=> (IbmMqEndpoint)new IbmMqComponent().CreateEndpoint(EndpointUriParser.Parse($"wmq:ORDERS?{Base}&{query}"));
[Theory]
[InlineData("maxBatchMessages=5", "maxBatchMessages")]
[InlineData("batchingIntervalMs=1000", "batchingIntervalMs")]
public void A_batch_option_without_batching_is_refused(string query, string named)
{
var act = () => Create(query);
act.Should().Throw().WithMessage($"*{named}*batching=true*");
}
[Fact]
public void Batching_with_the_listener_receive_mode_is_refused()
{
var act = () => Create("batching=true&backoutQueue=BOQ&receiveMode=listener");
act.Should().Throw().WithMessage("*receiveMode=listener*");
}
[Fact]
public void Batching_with_request_reply_is_refused()
{
var act = () => Create("batching=true&backoutQueue=BOQ&replyTo=true");
act.Should().Throw().WithMessage("*replyTo=true*");
}
[Theory]
[InlineData("maxBatchMessages=0", "maxBatchMessages")]
[InlineData("pollTimeoutMs=0", "pollTimeoutMs")]
[InlineData("batchingIntervalMs=0", "batchingIntervalMs")]
public void A_value_out_of_range_is_refused(string query, string named)
{
var act = () => Create($"batching=true&backoutQueue=BOQ&{query}");
act.Should().Throw().WithMessage($"*{named}*");
}
[Fact]
public void BatchSize_is_refused_naming_its_replacement()
{
var act = () => Create("batchSize=10");
act.Should().Throw().WithMessage("*batchSize*batching=true*maxBatchMessages*");
}
[Fact]
public void Batching_resolves_with_the_default_size()
{
var options = new IbmMqEndpointOptions { Batching = true, BackoutQueue = "BOQ" };
options.ResolveBatch("wmq:ORDERS");
options.Batch!.MaxMessages.Should().Be(100);
options.Batch.PollTimeout.Should().Be(TimeSpan.FromSeconds(1));
}
}