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-10352 Send created account email to johs #148

Merged
merged 1 commit into from
Dec 7, 2023
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
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
Loading