-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* VIH-7335 Sending Notification Email for judge and ejud judge * VIH-7335 courtroom account username for judge only
- Loading branch information
1 parent
4f44adf
commit 5667d2d
Showing
4 changed files
with
149 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,113 @@ namespace AdminWebsite.UnitTests.Mappers.NotificationMappers | |
public class MapToDemoOrTestNotificationTests | ||
{ | ||
[Test] | ||
public void Should_map_joh_demo_or_test_notification() | ||
public void Should_map_ejud_judge_demo_or_test_notification() | ||
{ | ||
//Arrange | ||
var hearing = new HearingDetailsResponse | ||
{ | ||
Id = Guid.NewGuid(), | ||
Participants = new List<ParticipantResponse>(), | ||
ScheduledDateTime = new DateTime(2020, 2, 10, 12, 15, 0, DateTimeKind.Utc) | ||
}; | ||
const NotificationType expectedNotificationType = NotificationType.EJudJudgeDemoOrTest; | ||
const string testType = "Generic"; | ||
const string caseNumber = "MBFY/17364"; | ||
|
||
var participant = new ParticipantResponse | ||
{ | ||
Id = Guid.NewGuid(), | ||
Username = "[email protected]", | ||
CaseRoleName = "caserolename", | ||
ContactEmail = "[email protected]", | ||
FirstName = "John", | ||
HearingRoleName = "hearingrolename", | ||
LastName = "Doe", | ||
TelephoneNumber = "0123456789", | ||
UserRoleName = "Judge", | ||
DisplayName = "Johnny", | ||
}; | ||
|
||
hearing.Participants.Add(participant); | ||
|
||
var expectedParameters = new Dictionary<string, string> | ||
{ | ||
{"case number", caseNumber}, | ||
{"test type", "Generic"}, | ||
{"date", "10 February 2020"}, | ||
{"time", "12:15 PM"}, | ||
{"judge", participant.DisplayName} | ||
}; | ||
|
||
//Act | ||
var result = AddNotificationRequestMapper.MapToDemoOrTestNotification(hearing, participant, caseNumber, testType); | ||
|
||
//Assert | ||
result.Should().NotBeNull(); | ||
result.HearingId.Should().Be(hearing.Id); | ||
result.ParticipantId.Should().Be(participant.Id); | ||
result.ContactEmail.Should().Be(participant.ContactEmail); | ||
result.NotificationType.Should().Be(expectedNotificationType); | ||
result.MessageType.Should().Be(MessageType.Email); | ||
result.PhoneNumber.Should().Be(participant.TelephoneNumber); | ||
result.Parameters.Should().BeEquivalentTo(expectedParameters); | ||
} | ||
|
||
[Test] | ||
public void Should_map_judge_demo_or_test_notification() | ||
{ | ||
//Arrange | ||
var hearing = new HearingDetailsResponse | ||
{ | ||
Id = Guid.NewGuid(), | ||
Participants = new List<ParticipantResponse>(), | ||
ScheduledDateTime = new DateTime(2020, 2, 10, 12, 15, 0, DateTimeKind.Utc) | ||
}; | ||
const NotificationType expectedNotificationType = NotificationType.JudgeDemoOrTest; | ||
const string testType = "Generic"; | ||
const string caseNumber = "MBFY/17364"; | ||
|
||
var participant = new ParticipantResponse | ||
{ | ||
Id = Guid.NewGuid(), | ||
Username = "[email protected]", | ||
CaseRoleName = "caserolename", | ||
ContactEmail = "[email protected]", | ||
FirstName = "John", | ||
HearingRoleName = "hearingrolename", | ||
LastName = "Doe", | ||
TelephoneNumber = "0123456789", | ||
UserRoleName = "Judge", | ||
DisplayName = "Johnny", | ||
}; | ||
|
||
hearing.Participants.Add(participant); | ||
|
||
var expectedParameters = new Dictionary<string, string> | ||
{ | ||
{"case number", caseNumber}, | ||
{"test type", "Generic"}, | ||
{"date", "10 February 2020"}, | ||
{"time", "12:15 PM"}, | ||
{"judge", participant.DisplayName}, | ||
{"courtroom account username", participant.Username} | ||
}; | ||
|
||
//Act | ||
var result = AddNotificationRequestMapper.MapToDemoOrTestNotification(hearing, participant, caseNumber, testType); | ||
|
||
//Assert | ||
result.Should().NotBeNull(); | ||
result.HearingId.Should().Be(hearing.Id); | ||
result.ParticipantId.Should().Be(participant.Id); | ||
result.ContactEmail.Should().Be(participant.ContactEmail); | ||
result.NotificationType.Should().Be(expectedNotificationType); | ||
result.MessageType.Should().Be(MessageType.Email); | ||
result.PhoneNumber.Should().Be(participant.TelephoneNumber); | ||
result.Parameters.Should().BeEquivalentTo(expectedParameters); | ||
} | ||
[Test] | ||
public void Should_map_ejud_joh_demo_or_test_notification() | ||
{ | ||
//Arrange | ||
var hearing = new HearingDetailsResponse | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters