Beispiel #1
0
        public async Task Handle_WhenHandlingSendInvitationEmailCommand_ThenShouldAddInvitation(
            [Frozen] Mock <IMessageSession> mockPublisher,
            [Frozen] ProviderRegistrationsSettings settings,
            SendInvitationEmailCommandHandler handler,
            SendInvitationEmailCommand command)
        {
            //arrange
            var tokens = new Dictionary <string, string>
            {
                { "provider_organisation", command.ProviderOrgName },
                { "provider_name", command.ProviderUserFullName },
                { "employer_organisation", command.EmployerOrganisation },
                { "employer_name", command.EmployerFullName },
                { "invitation_link", $"{settings.EmployerAccountsBaseUrl}/service/register/{command.CorrelationId}" },
                { "unsubscribe_training_provider", $"{settings.EmployerAccountsBaseUrl}/service/unsubscribe/{command.CorrelationId}" },
                { "report_training_provider", $"{settings.EmployerAccountsBaseUrl}/report/trainingprovider/{command.CorrelationId}" }
            };

            //act
            var result = await((IRequestHandler <SendInvitationEmailCommand, Unit>)handler).Handle(command, new CancellationToken());

            //assert
            mockPublisher.Verify(s => s.Send(It.Is <SendEmailCommand>(t =>
                                                                      t.TemplateId == "ProviderInviteEmployerNotification" &&
                                                                      t.RecipientsAddress == command.EmployerEmail &&
                                                                      t.Tokens.OrderBy(kvp => kvp.Key).SequenceEqual(tokens.OrderBy(kvp => kvp.Key))), It.IsAny <SendOptions>()));
        }
Beispiel #2
0
 public RegistrationController(
     IMediator mediator,
     IMapper mapper,
     IAuthenticationService authenticationService,
     ProviderRegistrationsSettings configuration)
 {
     _mediator = mediator;
     _mapper   = mapper;
     _authenticationService = authenticationService;
     _configuration         = configuration;
 }
Beispiel #3
0
 public SendInvitationEmailCommandHandler(IMessageSession publisher, ProviderRegistrationsSettings configuration)
 {
     _publisher     = publisher;
     _configuration = configuration;
 }