Example #1
0
        public async Task CanRegisterWithASocialLoginProviderFromLoginWithConfirmationAndRealEmailSender()
        {
            // Arrange
            var emailSender = new ContosoEmailSender();

            void ConfigureTestServices(IServiceCollection services)
            {
                services.SetupTestEmailSender(emailSender);
                services
                .Configure <IdentityOptions>(o => o.SignIn.RequireConfirmedAccount = true)
                .SetupTestThirdPartyLogin();
            }

            var client = ServerFactory
                         .WithWebHostBuilder(whb => whb.ConfigureServices(ConfigureTestServices))
                         .CreateClient();

            var guid     = Guid.NewGuid();
            var userName = $"{guid}";
            var email    = $"{guid}@example.com";

            // Act & Assert
            await UserStories.RegisterNewUserWithSocialLoginWithConfirmationAsync(client, userName, email, hasRealEmailSender : true);

            Assert.Single(emailSender.SentEmails);
        }