Beispiel #1
0
        public void Should_have_expired_empty_authentication_cookie_in_logout_response_when_user_logs_out_with_redirect()
        {
            FormsAuthentication.Enable(A.Fake <IPipelines>(), this.config);

            var result = FormsAuthentication.LogOutAndRedirectResponse(context, "/");

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

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