Beispiel #1
0
        public async Task ThenAnInvitationIsAdded(
            [Frozen] Mock <IMediator> mediator,
            [Frozen] Mock <IAuthenticationService> authService,
            RegistrationController controller,
            NewEmployerUserViewModel model,
            string command,
            string providerName)
        {
            //arrange
            authService.Object.TryGetUserClaimValue(ProviderClaims.DisplayName, out var displayName);
            mediator.Setup(s => s.Send(It.IsAny <GetProviderByUkprnQuery>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new GetProviderByUkprnQueryResult(providerName));

            //act
            await controller.InviteEmployeruser(model, command);

            //assert
            mediator.Verify(x => x.Send(It.Is <AddInvitationCommand>(s =>
                                                                     s.EmployerEmail == model.EmployerEmailAddress &&
                                                                     s.EmployerFirstName == model.EmployerFirstName &&
                                                                     s.EmployerLastName == model.EmployerLastName &&
                                                                     s.EmployerOrganisation == model.EmployerOrganisation &&
                                                                     s.Ukprn == authService.Object.Ukprn.Value &&
                                                                     s.UserRef == authService.Object.UserId &&
                                                                     s.ProviderOrganisationName == providerName &&
                                                                     s.ProviderUserFullName == displayName), It.IsAny <CancellationToken>()), Times.Once);
        }