Ejemplo n.º 1
0
        public async Task <ConfirmEmail> ClickConfirmLinkAsync()
        {
            var goToConfirm = await Client.GetAsync(_confirmLink.Href);

            var confirm = await ResponseAssert.IsHtmlDocumentAsync(goToConfirm);

            return(await ConfirmEmail.Create(_confirmLink, Client, Context));
        }
Ejemplo n.º 2
0
        public static async Task <Index> CreateAsync(HttpClient client, DefaultUIContext context = null)
        {
            var goToIndex = await client.GetAsync("/");

            var index = await ResponseAssert.IsHtmlDocumentAsync(goToIndex);

            return(new Index(client, index, context ?? new DefaultUIContext()));
        }
Ejemplo n.º 3
0
        public static async Task <Index> CreateAsync(HttpClient client, bool authenticated = false)
        {
            var goToIndex = await client.GetAsync("/");

            var index = await ResponseAssert.IsHtmlDocumentAsync(goToIndex);

            return(new Index(client, index, new HtmlPageContext(), authenticated));
        }
Ejemplo n.º 4
0
        internal async Task <Account.Manage.Index> ClickManageLinkAsync()
        {
            Assert.True(Context.UserAuthenticated);

            var goToManage = await Client.GetAsync(_manageLink.Href);

            var manage = await ResponseAssert.IsHtmlDocumentAsync(goToManage);

            return(new Account.Manage.Index(Client, manage, Context));
        }
Ejemplo n.º 5
0
        public async Task <Login> ClickLoginLinkAsync()
        {
            Assert.False(Context.UserAuthenticated);

            var goToLogin = await Client.GetAsync(_loginLink.Href);

            var login = await ResponseAssert.IsHtmlDocumentAsync(goToLogin);

            return(new Login(Client, login, Context));
        }
Ejemplo n.º 6
0
        public async Task <Register> ClickRegisterLinkAsync()
        {
            Assert.False(Context.UserAuthenticated);

            var goToRegister = await Client.GetAsync(_registerLink.Href);

            var register = await ResponseAssert.IsHtmlDocumentAsync(goToRegister);

            return(new Register(Client, register, Context));
        }
Ejemplo n.º 7
0
        public async Task AnonymousUserCanAccessNotAuthorizedPages(string url)
        {
            // Arrange
            var client = ServerFactory.CreateDefaultClient();

            // Act
            var response = await client.GetAsync(url);

            // Assert
            await ResponseAssert.IsHtmlDocumentAsync(response);
        }
Ejemplo n.º 8
0
        internal async Task <Account.Manage.Index> ClickManageLinkWithExternalLoginAsync()
        {
            Assert.True(Context.UserAuthenticated);

            var goToManage = await Client.GetAsync(_manageLink.Href);

            var manage = await ResponseAssert.IsHtmlDocumentAsync(goToManage);

            return(new Account.Manage.Index(Client, manage, Context
                                            .WithSocialLoginEnabled()
                                            .WithSocialLoginProvider()));
        }
Ejemplo n.º 9
0
        public async Task AuthenticatedUserCanAccessAuthorizedPages(string url)
        {
            // Arrange
            var client = ServerFactory.CreateDefaultClient();
            await UserStories.RegisterNewUserAsync(client);

            // Act
            var response = await client.GetAsync(url);

            // Assert
            await ResponseAssert.IsHtmlDocumentAsync(response);
        }
Ejemplo n.º 10
0
        public async Task AnonymousUserAllowedAccessToPages_WithGlobalAuthorizationFilter(string url)
        {
            // Arrange
            var server = ServerFactory.CreateServer(builder =>
                                                    builder.ConfigureServices(services => services.SetupGlobalAuthorizeFilter()));
            var client = ServerFactory.CreateDefaultClient(server);

            // Act
            var response = await client.GetAsync(url);

            // Assert
            await ResponseAssert.IsHtmlDocumentAsync(response);
        }
Ejemplo n.º 11
0
        public async Task AnonymousUserCanAccessNotAuthorizedPages(string url)
        {
            using (StartLog(out var loggerFactory, $"{nameof(AnonymousUserCanAccessNotAuthorizedPages)}_{WebUtility.UrlEncode(url)}"))
            {
                // Arrange
                var client = ServerFactory.CreateDefaultClient(loggerFactory);

                // Act
                var response = await client.GetAsync(url);

                // Assert
                await ResponseAssert.IsHtmlDocumentAsync(response);
            }
        }
Ejemplo n.º 12
0
        public async Task AnonymousUserAllowedAccessToPages_WithGlobalAuthorizationFilter(string url)
        {
            // Arrange
            void TestServicesConfiguration(IServiceCollection services) =>
            services.SetupGlobalAuthorizeFilter();

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

            // Act
            var response = await client.GetAsync(url);

            // Assert
            await ResponseAssert.IsHtmlDocumentAsync(response);
        }
Ejemplo n.º 13
0
        public async Task AnonymousUserAllowedAccessToPages_WithGlobalAuthorizationFilter(string url)
        {
            using (StartLog(out var loggerFactory, $"{nameof(AnonymousUserAllowedAccessToPages_WithGlobalAuthorizationFilter)}_{WebUtility.UrlEncode(url)}"))
            {
                // Arrange
                var server = ServerFactory.CreateServer(loggerFactory, builder =>
                                                        builder.ConfigureServices(services => services.SetupGlobalAuthorizeFilter()));
                var client = ServerFactory.CreateDefaultClient(server);

                // Act
                var response = await client.GetAsync(url);

                // Assert
                await ResponseAssert.IsHtmlDocumentAsync(response);
            }
        }