Пример #1
0
        public void CookieService_GetCookie_Base64_Fail()
        {
            CookieFake cookie = new CookieFake {
                TestProperty = 25, TestPropertyString = "blah"
            };

            _target.Set("fakecookie", cookie);

            CookieFake cachedCookie = _target.Get <CookieFake>("fakecookie", true);

            Assert.IsNull(cachedCookie);
        }
Пример #2
0
        public void CookieService_SetCookie_Base64_Success()
        {
            CookieFake cookie = new CookieFake {
                TestProperty = 25, TestPropertyString = "blah"
            };

            _target.Set("fakecookie", cookie, base64Encode: true);

            CookieFake cachedCookie = _target.Get <CookieFake>("fakecookie", true);

            Assert.IsNotNull(cachedCookie);
            Assert.AreEqual(cookie.TestProperty, cachedCookie.TestProperty);
            Assert.AreEqual(cookie.TestPropertyString, cachedCookie.TestPropertyString);
        }
Пример #3
0
        public void CookieService_GetOrSetCookie_GetsCookie_Success()
        {
            CookieFake cookie = new CookieFake {
                TestProperty = 25, TestPropertyString = "blah"
            };

            _target.Set("fakecookie", cookie);

            Func <CookieFake> createCookie = () =>
            {
                return(new CookieFake {
                    TestProperty = 55, TestPropertyString = "blah2"
                });
            };

            var retrievedCookie = _target.GetOrSet <CookieFake>("fakecookie", createCookie);

            Assert.IsNotNull(retrievedCookie);
            Assert.AreEqual(retrievedCookie.TestProperty, cookie.TestProperty);
            Assert.AreEqual(retrievedCookie.TestPropertyString, cookie.TestPropertyString);
        }
Пример #4
0
        public void CookieService_GetCookie_Fail()
        {
            CookieFake cachedCookie = _target.Get <CookieFake>("fakecookie");

            Assert.IsNull(cachedCookie);
        }