Exemplo n.º 1
0
 public void Cookie_can_be_overwritten()
 {
     WebsiteCookies w = new WebsiteCookies();
     w.Add("test", "value");
     w.Add("test", "newvalue");
     Assert.IsTrue(w.GetCookie("test").Value == "newvalue");
 }
Exemplo n.º 2
0
        public void Cookie_can_be_removed()
        {
            WebsiteCookies w = new WebsiteCookies();
            w.Add("existant_key", "value");
            w.RequestDelete("existant_key");

            //check if cookie was set to be reset in response
            var cookie = w.GetCookie("existant_key");
            Assert.IsTrue(cookie.Value == "deleted");

            //check if cookie expiration date is lower than current date
            Assert.IsTrue(cookie.Expires < DateTime.Now);
        }
Exemplo n.º 3
0
 public void Non_existant_cookie_is_nulled()
 {
     WebsiteCookies w = new WebsiteCookies();
     var value = w.GetCookie("non-existant-key");
     Assert.IsNull(value);
 }
Exemplo n.º 4
0
 public void Cookie_can_be_saved_and_restored()
 {
     WebsiteCookies w = new WebsiteCookies();
     w.Add("test", "value");
     Assert.IsTrue(w.GetCookie("test").Value == "value");
 }