示例#1
0
 public void InvalidateAllCookies()
 {
     foreach (string cookieName in _cookieHandler.GetRequestCookies())
     {
         InvalidateCookie(cookieName);
     }
 }
        public void SetUp()
        {
            customCookie1 = new HttpCookie("foo") { Value = "foo-value", Path = "/" };
            customCookie2 = new HttpCookie("bar") { Value = "bar-value", Path = "/" };
            var requestCookies = new HttpCookieCollection {customCookie1, customCookie2};

            httpRequest = new FakeHttpRequest("http://foo.bar", true);
            httpResponse = new FakeHttpResponse();
            httpContext = new FakeHttpContext(httpRequest, httpResponse);

            cookieHandler = Substitute.For<IHttpCookieHandler>();
            cookieHandler.GetRequestCookies().Returns(requestCookies);

            cookieInvalidator = new DomainCookieInvalidator("foo.bar", httpContext, cookieHandler);
        }
示例#3
0
        public void SetUp()
        {
            _customCookie1 = new HttpCookie("foo")
            {
                Value = "foo-value", Path = "/"
            };
            _customCookie2 = new HttpCookie("bar")
            {
                Value = "bar-value", Path = "/"
            };
            var requestCookies = new HttpCookieCollection {
                _customCookie1, _customCookie2
            };

            _httpRequest  = new FakeHttpRequest("http://foo.bar", true);
            _httpResponse = new FakeHttpResponse();
            _httpContext  = new FakeHttpContext(_httpRequest, _httpResponse);

            _cookieHandler = Substitute.For <IHttpCookieHandler>();
            _cookieHandler.GetRequestCookies().Returns(requestCookies);

            _cookieInvalidator = new DomainCookieInvalidator("foo.bar", _httpContext, _cookieHandler);
        }
示例#4
0
        public void GetRequestCookies_ShouldReturnEmptyCollectionForNoExistingCookies()
        {
            var cookies = _cookieHandler.GetRequestCookies();

            Assert.That(cookies.Count, Is.EqualTo(0));
        }