-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Host.RabbitMQ] Automatically ack messages #21
Signed-off-by: Tomasz Maruszak <[email protected]>
- Loading branch information
Showing
6 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/Tests/SlimMessageBus.Host.RabbitMQ.Test/Config/RabbitMqConsumerBuilderExtensionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace SlimMessageBus.Host.RabbitMQ.Test.Config; | ||
|
||
public class RabbitMqConsumerBuilderExtensionsTests | ||
{ | ||
private readonly MessageBusSettings _settings = new(); | ||
private readonly ConsumerBuilder<object> _consumerBuilder; | ||
private readonly Fixture _fixture = new(); | ||
|
||
public RabbitMqConsumerBuilderExtensionsTests() | ||
{ | ||
_consumerBuilder = new ConsumerBuilder<object>(_settings); | ||
} | ||
|
||
[Fact] | ||
internal void When_UseAcknowledgementMode_Then_ValueStoredProperly() | ||
{ | ||
// arrange | ||
var mode = _fixture.Create<RabbitMqMessageAcknowledgementMode>(); | ||
|
||
// act | ||
_consumerBuilder.AcknowledgementMode(mode); | ||
|
||
// assert | ||
var modeReturned = _consumerBuilder.Settings.GetOrDefault<RabbitMqMessageAcknowledgementMode>(RabbitMqProperties.MessageAcknowledgementMode); | ||
modeReturned.Should().Be(mode); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...sts/SlimMessageBus.Host.RabbitMQ.Test/Config/RabbitMqMessageBusSettingsExtensionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
namespace SlimMessageBus.Host.RabbitMQ.Test.Config; | ||
|
||
public class RabbitMqMessageBusSettingsExtensionsTests | ||
{ | ||
private readonly RabbitMqMessageBusSettings _settings = new(); | ||
private readonly Fixture _fixture = new(); | ||
|
||
[Fact] | ||
internal void When_UseAcknowledgementMode_Then_ValueStoredProperly() | ||
{ | ||
// arrange | ||
var mode = _fixture.Create<RabbitMqMessageAcknowledgementMode>(); | ||
|
||
// act | ||
_settings.AcknowledgementMode(mode); | ||
|
||
// assert | ||
var modeReturned = _settings.GetOrDefault<RabbitMqMessageAcknowledgementMode>(RabbitMqProperties.MessageAcknowledgementMode); | ||
modeReturned.Should().Be(mode); | ||
} | ||
|
||
[Fact] | ||
internal void When_UseRoutingKeyProvider_Then_ValueStoredProperly() | ||
{ | ||
// arrange | ||
var routingKeyProviderMock = new Mock<RabbitMqMessageRoutingKeyProvider<object>>(); | ||
|
||
// act | ||
_settings.UseRoutingKeyProvider(routingKeyProviderMock.Object); | ||
|
||
// assert | ||
var routingKeyProviderReturned = _settings.GetOrDefault<RabbitMqMessageRoutingKeyProvider<object>>(RabbitMqProperties.MessageRoutingKeyProvider); | ||
routingKeyProviderReturned.Should().BeSameAs(routingKeyProviderMock.Object); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
global using AutoFixture; | ||
|
||
global using FluentAssertions; | ||
|
||
global using Microsoft.Extensions.Configuration; | ||
|