-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ContributorVerifiedEventTests for upcoming Scenario tests, Add…
… StartContributorVerificationCommand tests for saga
- Loading branch information
1 parent
7ff4396
commit 5e5de54
Showing
2 changed files
with
44 additions
and
28 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
44 changes: 44 additions & 0 deletions
44
...al.UnitTests/ContributorVerificationSagaTests/StartContributorVerificationCommandTests.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,44 @@ | ||
using FluentAssertions; | ||
using NServiceBus.Testing; | ||
using NServiceBusTutorial.Core.ContributorAggregate.Commands; | ||
using NServiceBusTutorial.Saga; | ||
using Xunit; | ||
|
||
namespace NServiceBusTutorial.UnitTests.ContributorVerificationSagaTests; | ||
|
||
public class StartContributorVerificationCommandTests | ||
{ | ||
[Fact] | ||
public async Task ShouldSendVerifyContributorCommand() | ||
{ | ||
var message = new StartContributorVerificationCommand(); | ||
var saga = new ContributorVerificationSaga | ||
{ | ||
Data = new() | ||
}; | ||
var context = new TestableMessageHandlerContext(); | ||
|
||
await saga.Handle(message, context); | ||
|
||
var sentMessage = context.FindSentMessage<VerifyContributorCommand>(); | ||
sentMessage.Should().NotBeNull(); | ||
} | ||
|
||
[Fact] | ||
public async Task ShouldSetContributorIdOnSagaState() | ||
{ | ||
var message = new StartContributorVerificationCommand() | ||
{ | ||
ContributorId = 4680 | ||
}; | ||
var saga = new ContributorVerificationSaga | ||
{ | ||
Data = new() | ||
}; | ||
var context = new TestableMessageHandlerContext(); | ||
|
||
await saga.Handle(message, context); | ||
|
||
saga.Data.ContributorId.Should().Be(message.ContributorId); | ||
} | ||
} |