public void should_map_to_joh_confirmation_notification()
        {
            var expectedNotificationType = NotificationType.HearingReminderJoh;
            var participant = InitParticipant("Judicial Office Holder");
            var hearing     = InitHearing();

            var expectedParameters = new Dictionary <string, string>
            {
                { "case name", hearing.Cases.First().Name },
                { "case number", hearing.Cases.First().Number },
                { "time", "2:10 PM" },
                { "day month year", "12 October 2020" },
                { "judicial office holder", $"{participant.FirstName} {participant.LastName}" },
                { "username", participant.Username }
            };

            var result = AddNotificationRequestMapper.MapToHearingReminderNotification(hearing, participant);

            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);
        }
        public async Task SendHearingReminderEmail(HearingDetailsResponse hearing)
        {
            if (hearing.IsGenericHearing())
            {
                return;
            }

            if (hearing.DoesJudgeEmailExist())
            {
                await SendJudgeConfirmationEmail(hearing);
            }

            var requests = hearing.Participants
                           .Where(x => !x.UserRoleName.Contains("Judge", StringComparison.CurrentCultureIgnoreCase))
                           .Select(participant => AddNotificationRequestMapper.MapToHearingReminderNotification(hearing, participant))
                           .ToList();

            await Task.WhenAll(requests.Select(_notificationApiClient.CreateNewNotificationAsync));
        }