diff --git a/test/Altinn.Notifications.Tests/Notifications/TestingMappers/OrderMapperTests.cs b/test/Altinn.Notifications.Tests/Notifications/TestingMappers/OrderMapperTests.cs index a3e332cc4..dcfa9dff4 100644 --- a/test/Altinn.Notifications.Tests/Notifications/TestingMappers/OrderMapperTests.cs +++ b/test/Altinn.Notifications.Tests/Notifications/TestingMappers/OrderMapperTests.cs @@ -140,6 +140,42 @@ public void MapToOrderRequest_RecipientsProvided_AreEquivalent() Assert.Equivalent(expected, actual, true); } + [Fact] + public void MapToOrderRequest_SendTimeLocalConvertedToUtc_AreEquivalent() + { + DateTime sendTime = DateTime.Now; // Setting the time in Local time zone + + // Arrange + EmailNotificationOrderRequestExt orderRequestExt = new() + { + Body = "email-body", + ContentType = EmailContentTypeExt.Html, + RequestedSendTime = sendTime, // Local time zone + Subject = "email-subject" + }; + + NotificationOrderRequest expected = new() + { + Creator = new Creator("ttd"), + Templates = new List() + { + new EmailTemplate( + string.Empty, + "email-subject", + "email-body", + EmailContentType.Html) + }, + RequestedSendTime = sendTime.ToUniversalTime(), // Expecting the time in UTC time zone + NotificationChannel = NotificationChannel.Email + }; + + // Act + var actual = orderRequestExt.MapToOrderRequest("ttd"); + + // Assert + Assert.Equivalent(expected, actual, true); + } + [Fact] public void MapToNotificationOrderWithStatusExt_EmailStatusProvided_AreEquivalent() {