Skip to content

Commit

Permalink
VIH-10353 - Admin web Unable to sent notifications for Edit hearings (#…
Browse files Browse the repository at this point in the history
…149)

* Update NotificationParameterMapper.cs

* added test

* Update MapToHearingAmendmentNotificationTests.cs

* Update MapToHearingAmendmentNotificationTests.cs
  • Loading branch information
marcogagliardi authored Dec 8, 2023
1 parent 2c522ee commit 38c6689
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System;
using FluentAssertions;
using NotificationApi.Common;
using NotificationApi.Contract.Requests;
using NUnit.Framework;

namespace NotificationApi.UnitTests.Mappers.NotificationParameterMapper
{
public class MapToHearingAmendmentNotificationTests
{

[Test]
public void should_map_to_amendment_notification_for_individual()
{
//Arrange
var oldDate = new DateTime(2020, 2, 10, 11, 30, 0, DateTimeKind.Utc);
var newDate = new DateTime(2020, 10, 12, 13, 10, 0, DateTimeKind.Utc);

var request = new HearingAmendmentRequest
{
HearingId = new Guid("73f2053e-74f1-4d6c-b817-246f4b22e666"),
ContactEmail = "[email protected]",
ParticipantId = new Guid("73f2053e-74f1-4d6c-b817-246f4b22e665"),
CaseName = "Case name",
PreviousScheduledDateTime = oldDate,
NewScheduledDateTime = newDate,
RoleName = "Individual",
CaseNumber = "Original Hearing",
Name = $"Automation_FirstName Automation_LastName",
DisplayName = "Automation_FirstName Automation_LastName",
Representee = "",
Username = "[email protected]"
};

//Act
var result = NotificationApi.Services.NotificationParameterMapper.MapToHearingAmendment(request);

//Assert
result.Should().NotBeNull();
result[NotifyParams.CaseName].Should().Be("Case name");
result[NotifyParams.UserName].Should().Be("[email protected]");
result[NotifyParams.CaseNumber].Should().Be("Original Hearing");
result[NotifyParams.OldTime].Should().Be("11:30 AM");
result[NotifyParams.NewTime].Should().Be("2:10 PM");
result[NotifyParams.OldDayMonthYear].Should().Be("10 February 2020");
result[NotifyParams.NewDayMonthYear].Should().Be("12 October 2020");
result[NotifyParams.Name].Should().Be("Automation_FirstName Automation_LastName");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ public static Dictionary<string, string> MapToHearingAmendment(HearingAmendmentR
var parameters = new Dictionary<string, string>
{
{NotifyParams.CaseName, request.CaseName},
{NotifyParams.UserName, request.Username.ToLower()},
{NotifyParams.CaseNumber, request.CaseNumber},
{NotifyParams.OldTime, request.PreviousScheduledDateTime.ToEmailTimeGbLocale()},
{NotifyParams.NewTime, request.NewScheduledDateTime.ToEmailTimeGbLocale()},
Expand Down

0 comments on commit 38c6689

Please sign in to comment.