Пример #1
0
        public void ShouldParseCookieWithoutExpiryAndNoValueCorrectly()
        {
            const string rawCookie = "USER=; path=/";

            var cookieParser = new CookieParser();
            HttpCookie cookie = cookieParser.ParseCookie(rawCookie);

            Assert.That(cookie.Name, Is.EqualTo("USER"));
            Assert.That(cookie.Value, Is.EqualTo(""));
            Assert.That(cookie.Expires, Is.EqualTo(DateTime.MinValue));
        }
Пример #2
0
        public void ShouldParseCookieWithEqualsInTheValue()
        {
            const string rawCookie = "DATA=USER=bob&FullName=Bob The Builder; path=/";

            var cookieParser = new CookieParser();
            HttpCookie cookie = cookieParser.ParseCookie(rawCookie);

            Assert.That(cookie.Name, Is.EqualTo("DATA"));
            Assert.That(cookie.Value, Is.EqualTo("USER=bob&FullName=Bob The Builder"));
            Assert.That(cookie.Expires, Is.EqualTo(DateTime.MinValue));
        }
Пример #3
0
        public void ShouldParseCookieWithExpiryButNoValueCorrectly()
        {
            var testDate = new DateTime(2010, 8, 3, 10, 25, 3);
            const string rawCookie = "USER=; expires=Tue, 03-Aug-2010 09:25:03 GMT; path=/";

            var cookieParser = new CookieParser();
            HttpCookie cookie = cookieParser.ParseCookie(rawCookie);

            Assert.That(cookie.Name, Is.EqualTo("USER"));
            Assert.That(cookie.Value, Is.EqualTo(""));
            Assert.That(cookie.Expires, Is.EqualTo(testDate));
        }