diff --git a/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/EmailOrderProcessingServiceTests.cs b/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/EmailOrderProcessingServiceTests.cs index bcde6902..300c13d2 100644 --- a/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/EmailOrderProcessingServiceTests.cs +++ b/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/EmailOrderProcessingServiceTests.cs @@ -28,19 +28,19 @@ public async Task ProcessOrder_NotificationServiceCalledOnceForEachRecipient() { Id = Guid.NewGuid(), NotificationChannel = NotificationChannel.Email, - Recipients = new List() - { + Recipients = + [ new() { - OrganizationNumber = "123456", - AddressInfo = [new EmailAddressPoint("email@test.com")] + OrganizationNumber = "123456", + AddressInfo = [new EmailAddressPoint("email@test.com")] }, new() { - OrganizationNumber = "654321", - AddressInfo = [new EmailAddressPoint("email@test.com")] + OrganizationNumber = "654321", + AddressInfo = [new EmailAddressPoint("email@test.com")] } - } + ] }; var serviceMock = new Mock(); @@ -59,28 +59,30 @@ public async Task ProcessOrder_NotificationServiceCalledOnceForEachRecipient() public async Task ProcessOrder_ExpectedInputToNotificationService() { // Arrange - Guid orderId = Guid.NewGuid(); DateTime requested = DateTime.UtcNow; + Guid orderId = Guid.NewGuid(); var order = new NotificationOrder() { Id = orderId, NotificationChannel = NotificationChannel.Email, RequestedSendTime = requested, - Recipients = new List() - { - new(new List() { new EmailAddressPoint("test@test.com") }, organizationNumber: "skd-orgno") - } + Recipients = + [ + new([new EmailAddressPoint("test@test.com")], organizationNumber: "skd-orgno") + ] }; List expectedEmailAddressPoints = [new("test@test.com")]; - EmailRecipient expectedEmailRecipient = new() - { - OrganizationNumber = "skd-orgno" - }; + EmailRecipient expectedEmailRecipient = new() { OrganizationNumber = "skd-orgno" }; var serviceMock = new Mock(); - serviceMock.Setup(s => s.CreateNotification(It.IsAny(), It.Is(d => d.Equals(requested)), It.Is>(r => AssertUtils.AreEquivalent(expectedEmailAddressPoints, r)), It.Is(e => AssertUtils.AreEquivalent(expectedEmailRecipient, e)), It.IsAny())); + serviceMock.Setup(s => s.CreateNotification( + It.IsAny(), + It.Is(d => d.Equals(requested)), + It.Is>(r => AssertUtils.AreEquivalent(expectedEmailAddressPoints, r)), + It.Is(e => AssertUtils.AreEquivalent(expectedEmailRecipient, e)), + It.IsAny())); var service = GetTestService(emailService: serviceMock.Object); @@ -101,16 +103,6 @@ public async Task ProcessOrder_NotificationServiceThrowsException_RepositoryNotC Recipients = [ new() - { - AddressInfo = - [ - new EmailAddressPoint() - { - AddressType = AddressType.Email, - EmailAddress = "recipient@domain.com" - } - ] - } ] }; @@ -179,13 +171,13 @@ public async Task ProcessOrderRetry_ServiceCalledIfRecipientNotInDatabase() { Id = Guid.NewGuid(), NotificationChannel = NotificationChannel.Email, - Recipients = new List() - { + Recipients = + [ new(), - new(new List() { new EmailAddressPoint("test@test.com") }, nationalIdentityNumber: "enduser-nin"), - new(new List() { new EmailAddressPoint("test@test.com") }, organizationNumber : "skd-orgNo"), - new(new List() { new EmailAddressPoint("test@domain.com") }) - } + new([new EmailAddressPoint("test@test.com")], nationalIdentityNumber: "enduser-nin"), + new([new EmailAddressPoint("test@test.com")], organizationNumber : "skd-orgNo"), + new([new EmailAddressPoint("test@domain.com")]) + ] }; var serviceMock = new Mock(); @@ -209,10 +201,10 @@ public async Task ProcessOrderRetry_ServiceCalledIfRecipientNotInDatabase() } private static EmailOrderProcessingService GetTestService( - IEmailNotificationRepository? emailRepo = null, - IEmailNotificationService? emailService = null, - IContactPointService? contactPointService = null, - IKeywordsService? keywordsService = null) + IEmailNotificationRepository? emailRepo = null, + IEmailNotificationService? emailService = null, + IContactPointService? contactPointService = null, + IKeywordsService? keywordsService = null) { if (emailRepo == null) {