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");
 }
        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);
        }
 public void Non_existant_cookie_is_nulled()
 {
     WebsiteCookies w = new WebsiteCookies();
     var value = w.GetCookie("non-existant-key");
     Assert.IsNull(value);
 }
 public void Cookie_can_be_saved_and_restored()
 {
     WebsiteCookies w = new WebsiteCookies();
     w.Add("test", "value");
     Assert.IsTrue(w.GetCookie("test").Value == "value");
 }