-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensuring reference type is only updated with contact point once
- Loading branch information
Showing
7 changed files
with
39 additions
and
77 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
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
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 |
---|---|---|
|
@@ -140,24 +140,19 @@ public async Task ProcessOrder_RecipientMissingEmail_ContactPointServiceCalled() | |
s => s.CreateNotification( | ||
It.IsAny<Guid>(), | ||
It.IsAny<DateTime>(), | ||
It.Is<Recipient>(r => (r.NationalIdentityNumber == "123456" && r.AddressInfo.Count == 1)), | ||
It.Is<Recipient>(r => r.NationalIdentityNumber == "123456"), | ||
It.IsAny<bool>())); | ||
|
||
var contactPointServiceMock = new Mock<IContactPointService>(); | ||
contactPointServiceMock.Setup(c => c.GetEmailContactPoints(It.Is<List<Recipient>>(r => r.Count == 1))) | ||
.ReturnsAsync((List<Recipient> r) => | ||
{ | ||
Recipient augumentedRecipient = new() { AddressInfo = [new EmailAddressPoint("[email protected]")], NationalIdentityNumber = r[0].NationalIdentityNumber }; | ||
return new List<Recipient>() { augumentedRecipient }; | ||
}); | ||
contactPointServiceMock.Setup(c => c.AddEmailContactPoints(It.Is<List<Recipient>>(r => r.Count == 1))); | ||
|
||
var service = GetTestService(emailService: notificationServiceMock.Object, contactPointService: contactPointServiceMock.Object); | ||
|
||
// Act | ||
await service.ProcessOrder(order); | ||
|
||
// Assert | ||
contactPointServiceMock.Verify(c => c.GetEmailContactPoints(It.Is<List<Recipient>>(r => r.Count == 1)), Times.Once); | ||
contactPointServiceMock.Verify(c => c.AddEmailContactPoints(It.Is<List<Recipient>>(r => r.Count == 1)), Times.Once); | ||
notificationServiceMock.VerifyAll(); | ||
} | ||
|
||
|
@@ -219,9 +214,7 @@ private static EmailOrderProcessingService GetTestService( | |
{ | ||
var contactPointServiceMock = new Mock<IContactPointService>(); | ||
contactPointServiceMock | ||
.Setup(e => e.GetEmailContactPoints(It.IsAny<List<Recipient>>())) | ||
.ReturnsAsync( | ||
(List<Recipient> recipients) => recipients); | ||
.Setup(e => e.AddEmailContactPoints(It.IsAny<List<Recipient>>())); | ||
contactPointService = contactPointServiceMock.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