Skip to content

Commit

Permalink
Merge branch 'master' into VIH-10353---Admin-web/-Unable-to-sent-noti…
Browse files Browse the repository at this point in the history
…fications-for-Edit-hearings
  • Loading branch information
marcogagliardi authored Dec 8, 2023
2 parents 6efeac2 + 2c522ee commit 1beab9a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,37 @@ public async Task should_send_a_created_account_email_for_a_representative()
ApiUriFactory.ParticipantNotificationEndpoints.SendParticipantCreatedAccountEmail, RequestBody.Set(request));


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

var notifications = await TestDataManager.GetNotifications(null, null,
Domain.Enums.NotificationType.CreateRepresentative, 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_created_account_email_for_a_judicial_office_holder()
{
// arrange
var request = new SignInDetailsEmailRequest
{
RoleName = RoleNames.JudicialOfficeHolder,
ContactEmail = $"{Guid.NewGuid()}@test.com",
Name = $"{Faker.Name.FullName()}",
Username = $"{Guid.NewGuid()}@test.com",
Password = $"{Faker.RandomNumber.Next()}",
};

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


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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public async Task<IActionResult> SendParticipantCreatedAccountEmailAsync(SignInD
{
RoleNames.Individual => NotificationType.CreateIndividual,
RoleNames.Representative => NotificationType.CreateRepresentative,
RoleNames.JudicialOfficeHolder => NotificationType.CreateRepresentative,
_ => throw new BadRequestException($"Provided role is not {request.RoleName}")
};

Expand Down

0 comments on commit 1beab9a

Please sign in to comment.