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-10399 Notify Templates being sent with EjuD sign in details #150

Merged
Show file tree
Hide file tree
Changes from 5 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
Expand Up @@ -64,6 +64,6 @@ public class ExistingUserMultiDayHearingConfirmationRequest

public bool HasAJudiciaryUsername()
{
return ContactEmail?.Contains("judiciary", StringComparison.CurrentCultureIgnoreCase) ?? false;
return Username.Contains("judiciary", StringComparison.CurrentCultureIgnoreCase);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ public class ExistingUserSingleDayHearingConfirmationRequest

public bool HasAJudiciaryUsername()
{
return ContactEmail?.Contains("judiciary", StringComparison.CurrentCultureIgnoreCase) ?? false;
return Username.Contains("judiciary", StringComparison.CurrentCultureIgnoreCase);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ public class HearingAmendmentRequest

public bool HasAJudiciaryUsername()
{
return ContactEmail?.Contains("judiciary", StringComparison.CurrentCultureIgnoreCase) ?? false;
return Username.Contains("judiciary", StringComparison.CurrentCultureIgnoreCase);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ public class SingleDayHearingReminderRequest

public bool HasAJudiciaryUsername()
{
return ContactEmail?.Contains("judiciary", StringComparison.CurrentCultureIgnoreCase) ?? false;
return Username.Contains("judiciary", StringComparison.CurrentCultureIgnoreCase);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,43 @@ public async Task should_send_a_confirmation_email_for_a_non_judiciary_judge()
).Should().BeTrue();
}


[Test]
public async Task should_send_a_confirmation_email_to_a_judiciary_email_for_a_non_judiciary_judge_using_the_standard_template()
{
// arrange
var request = new ExistingUserSingleDayHearingConfirmationRequest
{
RoleName = RoleNames.Judge,
Name = $"{Faker.Name.FullName()}",
DisplayName = "Judge Fudge",
CaseNumber = $"{Faker.RandomNumber.Next()}",
CaseName = $"{Faker.RandomNumber.Next()}",
HearingId = Guid.NewGuid(),
ParticipantId = Guid.NewGuid(),
ContactEmail = $"{Guid.NewGuid()}@judiciary.com",
Username = $"{Guid.NewGuid()}@hearings.reform.com",
ScheduledDateTime = DateTime.UtcNow.AddDays(1),
};

// act
using var client = Application.CreateClient();
var result = await client.PostAsync(
ApiUriFactory.ParticipantNotificationEndpoints.SendParticipantSingleDayHearingConfirmationForExistingUserEmail, RequestBody.Set(request));

// assert
result.IsSuccessStatusCode.Should().BeTrue(result.Content.ReadAsStringAsync().Result);

var notifications = await TestDataManager.GetNotifications(request.HearingId.Value,
request.ParticipantId.Value, Domain.Enums.NotificationType.HearingConfirmationJudge,
request.ContactEmail);
notifications.Count.Should().Be(1);
_notifyStub.SentEmails.Count.Should().Be(1);
_notifyStub.SentEmails.Exists(x => x.EmailAddress == request.ContactEmail
&& x.ExternalRefId == notifications[0].ExternalId
).Should().BeTrue();
}

[Test]
public async Task should_send_a_confirmation_email_for_a_judiciary_judge()
{
Expand Down
Loading