Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mizrael committed Aug 29, 2022
1 parent 4c299aa commit 4f5183f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
11 changes: 9 additions & 2 deletions samples/Sample9/Sample9.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30804.86
# Visual Studio Version 17
VisualStudioVersion = 17.2.32802.462
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSleigh.Samples.Sample9.API", "OpenSleigh.Samples.Sample9.API\OpenSleigh.Samples.Sample9.API.csproj", "{A94C718C-3B49-4E67-BACB-4B6615C97839}"
EndProject
Expand All @@ -17,6 +17,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSleigh.Samples.Sample9.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSleigh.Transport.Kafka", "..\..\src\OpenSleigh.Transport.Kafka\OpenSleigh.Transport.Kafka.csproj", "{36F37F51-015C-4B51-8EEE-0D5C93D5314A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenSleigh.Abstractions", "..\..\src\OpenSleigh.Abstractions\OpenSleigh.Abstractions.csproj", "{3C08B877-5589-465E-8C51-D338AB0CC4C9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -47,6 +49,10 @@ Global
{36F37F51-015C-4B51-8EEE-0D5C93D5314A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{36F37F51-015C-4B51-8EEE-0D5C93D5314A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{36F37F51-015C-4B51-8EEE-0D5C93D5314A}.Release|Any CPU.Build.0 = Release|Any CPU
{3C08B877-5589-465E-8C51-D338AB0CC4C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C08B877-5589-465E-8C51-D338AB0CC4C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C08B877-5589-465E-8C51-D338AB0CC4C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C08B877-5589-465E-8C51-D338AB0CC4C9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -55,6 +61,7 @@ Global
{CE375B34-1590-4544-9B33-70EF4C25D54C} = {179EFC5F-B0C8-4649-BF7C-24E9EBDFBBA8}
{02F45547-81D2-4F7A-8571-CEA585FCE8A7} = {179EFC5F-B0C8-4649-BF7C-24E9EBDFBBA8}
{36F37F51-015C-4B51-8EEE-0D5C93D5314A} = {179EFC5F-B0C8-4649-BF7C-24E9EBDFBBA8}
{3C08B877-5589-465E-8C51-D338AB0CC4C9} = {179EFC5F-B0C8-4649-BF7C-24E9EBDFBBA8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BC78DE5A-D1CC-46D6-ADDA-3A8F41324E03}
Expand Down
6 changes: 5 additions & 1 deletion src/OpenSleigh.Abstractions/Saga.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using OpenSleigh.Core.Persistence;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -31,7 +32,10 @@ internal async Task PersistOutboxAsync(IOutboxRepository outboxRepository, Cance
{
if (outboxRepository is null)
throw new ArgumentNullException(nameof(outboxRepository));


if (!_outbox.Any())
return;

await outboxRepository.AppendAsync(_outbox, cancellationToken)
.ConfigureAwait(false);

Expand Down
13 changes: 13 additions & 0 deletions tests/OpenSleigh.Core.Tests/Unit/SagaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,21 @@ public async Task PersistOutboxAsync_should_empty_outbox()
await sut.PersistOutboxAsync(outboxRepo, CancellationToken.None);
called.Should().BeTrue();

called = false;
await sut.PersistOutboxAsync(outboxRepo, CancellationToken.None);
called.Should().BeFalse();
}

[Fact]
public async Task PersistOutboxAsync_should_not_call_outbox_when_no_messages_to_send()
{
var state = new DummySagaState(Guid.NewGuid());
var sut = new DummySaga(state);

var outboxRepo = NSubstitute.Substitute.For<IOutboxRepository>();

await sut.PersistOutboxAsync(outboxRepo, CancellationToken.None);
await outboxRepo.DidNotReceiveWithAnyArgs().AppendAsync(Arg.Any<IEnumerable<IMessage>>(), Arg.Any<CancellationToken>());
}
}
}

0 comments on commit 4f5183f

Please sign in to comment.