Path: redb-route/tests/redb.Route.Tests.RabbitMQ/RetryOptionsTests.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.RabbitMQ/RetryOptionsTests.cs
----
using redb.Route.Core;
using redb.Route.RabbitMQ;
namespace redb.Route.Tests.RabbitMQ;
/// Apache Camel's failed-message options: defaults, the URI, the builder, and the values refused at start.
public sealed class RetryOptionsTests
{
[Fact]
public void Defaults_are_Camels()
{
var options = new RabbitMQEndpointOptions();
options.MaximumRetryAttempts.Should().Be(5);
options.RetryDelay.Should().Be(1000);
options.RejectAndDontRequeue.Should().BeTrue();
}
[Fact]
public void Set_from_the_uri()
{
var options = new RabbitMQEndpointOptions();
options.BindFromUri(EndpointUriParser.Parse(
"rabbitmq://q?maximumRetryAttempts=2&retryDelay=50&rejectAndDontRequeue=false").RawParameters);
options.MaximumRetryAttempts.Should().Be(2);
options.RetryDelay.Should().Be(50);
options.RejectAndDontRequeue.Should().BeFalse();
}
[Fact]
public void Set_by_the_builder()
=> Rabbit.Queue("q").MaximumRetryAttempts(2).RetryDelay(50).RejectAndDontRequeue(false).Build()
.Should().Contain("maximumRetryAttempts=2").And.Contain("retryDelay=50").And.Contain("rejectAndDontRequeue=false");
[Theory]
[InlineData(0, 1000, "maximumRetryAttempts")]
[InlineData(5, -1, "retryDelay")]
public void Values_out_of_range_are_refused(int attempts, int delay, string named)
{
var options = new RabbitMQEndpointOptions { MaximumRetryAttempts = attempts, RetryDelay = delay };
var act = () => options.Validate();
act.Should().Throw().WithMessage($"*{named}*");
}
}