Beispiel #1
0
        public When_ProviderQuarterlyUpdateEmail_Controller_ConfirmSendProviderEmail_Post_Is_Called_With_SendEmail_False()
        {
            var providerService = Substitute.For <IProviderService>();

            _providerQuarterlyUpdateEmailService = Substitute.For <IProviderQuarterlyUpdateEmailService>();

            const string adminEmail    = "*****@*****.**";
            var          configuration = new MatchingConfiguration
            {
                AuthorisedAdminUserEmail = adminEmail
            };

            var providerQuarterlyUpdateEmailController =
                new ProviderQuarterlyUpdateEmailController(_providerQuarterlyUpdateEmailService, providerService, configuration);
            var controllerWithClaims = new ClaimsBuilder <ProviderQuarterlyUpdateEmailController>(providerQuarterlyUpdateEmailController)
                                       .Add(ClaimTypes.Role, RolesExtensions.AdminUser)
                                       .AddEmail(adminEmail)
                                       .Build();

            var viewModel = new ConfirmSendProviderEmailViewModel
            {
                ProviderCount = 100,
                SendEmail     = false
            };

            _result = controllerWithClaims.ConfirmSendProviderEmailAsync(viewModel).GetAwaiter().GetResult();
        }
        public When_ProviderQuarterlyUpdateEmail_Controller_ConfirmSendProviderEmail_Is_Loaded()
        {
            _providerService = Substitute.For <IProviderService>();
            var providerQuarterlyUpdateEmailService = Substitute.For <IProviderQuarterlyUpdateEmailService>();

            _providerService
            .GetProvidersWithFundingCountAsync()
            .Returns(42);

            const string adminEmail    = "*****@*****.**";
            var          configuration = new MatchingConfiguration
            {
                AuthorisedAdminUserEmail = adminEmail
            };

            var providerQuarterlyUpdateEmailController =
                new ProviderQuarterlyUpdateEmailController(providerQuarterlyUpdateEmailService, _providerService, configuration);
            var controllerWithClaims = new ClaimsBuilder <ProviderQuarterlyUpdateEmailController>(providerQuarterlyUpdateEmailController)
                                       .Add(ClaimTypes.Role, RolesExtensions.AdminUser)
                                       .AddEmail(adminEmail)
                                       .Build();

            _result = controllerWithClaims.ConfirmSendProviderEmailAsync().GetAwaiter().GetResult();
        }