diff --git a/NotificationApi/NotificationApi.IntegrationTests/Api/ParticipantNotifications/SendParticipantCreatedAccountEmailTests.cs b/NotificationApi/NotificationApi.IntegrationTests/Api/ParticipantNotifications/SendParticipantCreatedAccountEmailTests.cs index 2d158b5c..ea7d6f53 100644 --- a/NotificationApi/NotificationApi.IntegrationTests/Api/ParticipantNotifications/SendParticipantCreatedAccountEmailTests.cs +++ b/NotificationApi/NotificationApi.IntegrationTests/Api/ParticipantNotifications/SendParticipantCreatedAccountEmailTests.cs @@ -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); diff --git a/NotificationApi/NotificationApi/Controllers/ParticipantEmailNotificationsController.cs b/NotificationApi/NotificationApi/Controllers/ParticipantEmailNotificationsController.cs index 8e4083d7..35151cb0 100644 --- a/NotificationApi/NotificationApi/Controllers/ParticipantEmailNotificationsController.cs +++ b/NotificationApi/NotificationApi/Controllers/ParticipantEmailNotificationsController.cs @@ -35,6 +35,7 @@ public async Task SendParticipantCreatedAccountEmailAsync(SignInD { RoleNames.Individual => NotificationType.CreateIndividual, RoleNames.Representative => NotificationType.CreateRepresentative, + RoleNames.JudicialOfficeHolder => NotificationType.CreateRepresentative, _ => throw new BadRequestException($"Provided role is not {request.RoleName}") };