Esempio n. 1
0
        public void Should_return_ok_response_when_user_logs_out_without_redirect()
        {
            // Given
            FormsAuthentication.Enable(A.Fake <IPipelines>(), this.config);

            // When
            var result = FormsAuthentication.LogOutResponse();

            // Then
            result.ShouldBeOfType(typeof(Response));
            result.StatusCode.ShouldEqual(HttpStatusCode.OK);
        }
Esempio n. 2
0
        public void Should_set_authentication_cookie_to_secure_when_config_requires_ssl_and_user_logs_out_without_redirect()
        {
            // Given
            FormsAuthentication.Enable(A.Fake <IPipelines>(), this.secureConfig);

            // When
            var result = FormsAuthentication.LogOutResponse();

            // Then
            var cookie = result.Cookies.Where(c => c.Name == FormsAuthentication.FormsAuthenticationCookieName).First();

            cookie.Secure.ShouldBeTrue();
        }
Esempio n. 3
0
        public void Should_have_expired_empty_authentication_cookie_in_logout_response_when_user_logs_out_without_redirect()
        {
            // Given
            FormsAuthentication.Enable(A.Fake <IPipelines>(), this.config);

            // When
            var result = FormsAuthentication.LogOutResponse();

            // Then
            var cookie = result.Cookies.First(c => c.Name == FormsAuthentication.FormsAuthenticationCookieName);

            cookie.Value.ShouldBeEmpty();
            cookie.Expires.ShouldNotBeNull();
            (cookie.Expires < DateTime.Now).ShouldBeTrue();
        }