Skip to content

Commit

Permalink
Test added for the modification to convert Local to UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
khanrn committed Nov 27, 2023
1 parent 10fa6f0 commit c43f95e
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<INotificationTemplate>()
{
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()
{
Expand Down

0 comments on commit c43f95e

Please sign in to comment.