Path: redb-route/tests/redb.Route.Tests.Sqs/AckModeOptionsTests.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.Sqs/AckModeOptionsTests.cs
----
using AwesomeAssertions;
using redb.Route.Core;
using redb.Route.Sqs;
namespace redb.Route.Tests.Sqs;
///
/// ackMode, the one option that says when a consumer settles what it received (manual: after the route,
/// auto: on receipt). The connector's former option is refused with its replacement named.
///
public class AckModeOptionsTests
{
private static SqsEndpointOptions Bind(params (string Key, string Value)[] parameters)
{
var options = new SqsEndpointOptions();
options.BindFromUri(parameters.ToDictionary(p => p.Key, p => p.Value));
return options;
}
[Fact]
public void The_default_is_manual() => new SqsEndpointOptions().AckMode.Should().Be(AckMode.Manual);
[Fact]
public void Auto_binds_from_the_uri() => Bind(("ackMode", "auto")).AckMode.Should().Be(AckMode.Auto);
[Fact]
public void The_former_option_is_refused_with_its_replacement()
{
var act = () => Bind(("deleteAfterRead", "false"));
act.Should().Throw().WithMessage("*'deleteAfterRead' is replaced by 'ackMode'*");
}
[Fact]
public void Auto_with_resetVisibilityOnFailure_is_refused()
{
var options = Bind(("region", "us-east-1"), ("useDefaultCredentialsProvider", "true"), ("ackMode", "auto"), ("resetVisibilityOnFailure", "true"));
var act = () => options.Validate();
act.Should().Throw().WithMessage("*ackMode=auto*resetVisibilityOnFailure*");
}
}