-
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.
* Update OrderMapper.cs * added unit test * Update test/Altinn.Notifications.Tests/Notifications/TestingMappers/OrderMapperTests.cs
- Loading branch information
Showing
2 changed files
with
67 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -266,6 +266,72 @@ public void ForSmsMapToOrderRequest_SendTimeLocalConvertedToUtc_AreEquivalent() | |
Assert.Equivalent(expected, actual, true); | ||
} | ||
|
||
[Theory] | ||
[InlineData(NotificationChannelExt.Email, NotificationChannel.Email)] | ||
[InlineData(NotificationChannelExt.EmailPreferred, NotificationChannel.EmailPreferred)] | ||
[InlineData(NotificationChannelExt.Sms, NotificationChannel.Sms)] | ||
[InlineData(NotificationChannelExt.SmsPreferred, NotificationChannel.SmsPreferred)] | ||
public void MapToOrderRequest_AreEquivalent(NotificationChannelExt extChannel, NotificationChannel expectedChannel) | ||
{ | ||
// Arrange | ||
DateTime sendTime = DateTime.UtcNow; | ||
|
||
NotificationOrderRequestExt ext = new() | ||
{ | ||
NotificationChannel = extChannel, | ||
EmailTemplate = new() | ||
{ | ||
Subject = "email-subject", | ||
Body = "email-body", | ||
ContentType = EmailContentTypeExt.Html | ||
}, | ||
SmsTemplate = new() | ||
{ | ||
Body = "sms-body", | ||
}, | ||
Recipients = new List<RecipientExt>() { new RecipientExt() { EmailAddress = "[email protected]" }, new RecipientExt() { NationalIdentityNumber = "123456" } }, | ||
SendersReference = "senders-reference", | ||
RequestedSendTime = sendTime, | ||
ConditionEndpoint = new Uri("https://vg.no"), | ||
IgnoreReservation = true, | ||
ResourceId = "urn:altinn:resource:test" | ||
}; | ||
|
||
NotificationOrderRequest expected = new() | ||
{ | ||
SendersReference = "senders-reference", | ||
Creator = new Creator("ttd"), | ||
Templates = new List<INotificationTemplate>() | ||
{ | ||
new EmailTemplate( | ||
string.Empty, | ||
"email-subject", | ||
"email-body", | ||
EmailContentType.Html), | ||
new SmsTemplate( | ||
string.Empty, | ||
"sms-body") | ||
}, | ||
RequestedSendTime = sendTime, | ||
Recipients = new List<Recipient>() | ||
{ | ||
new Recipient() { AddressInfo = new List<IAddressPoint>() { new EmailAddressPoint("[email protected]") } }, | ||
new Recipient() { NationalIdentityNumber = "123456" } | ||
}, | ||
ConditionEndpoint = new Uri("https://vg.no"), | ||
IgnoreReservation = true, | ||
ResourceId = "urn:altinn:resource:test" | ||
}; | ||
|
||
expected.NotificationChannel = expectedChannel; | ||
|
||
// Act | ||
var actual = ext.MapToOrderRequest("ttd"); | ||
|
||
// Assert | ||
Assert.Equivalent(expected, actual); | ||
} | ||
|
||
[Fact] | ||
public void MapToNotificationOrderWithStatusExt_EmailStatusProvided_AreEquivalent() | ||
{ | ||
|