Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIH-10353 - Admin web Unable to sent notifications for Edit hearings #149

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading