Esempio n. 1
0
 public void ItCanDeleteCookies()
 {
     var response = new Response();
     response.SetCookie("foo", "bar");
     response.SetCookie("foo2", "bar2");
     response.DeleteCookie("foo");
     Assert.That(response.GetHeaders("Set-Cookie"), Is.EquivalentTo(new[] { "foo2=bar2; path=/", "foo=; expires=Thu, 01-Jan-1970 00:00:00 GMT" }));
 }
Esempio n. 2
0
 public void ItCanDeleteCookiesWithTheSameNameFromMultipleDomains()
 {
     var response = new Response();
     response.SetCookie("foo", new Response.Cookie { Value = "bar", Domain = "sample.example.com" });
     response.SetCookie("foo", new Response.Cookie { Value = "bar", Domain = ".example.com" });
     Assert.That(response.GetHeaders("Set-Cookie"), Is.EquivalentTo(new[]
     {
         "foo=bar; domain=sample.example.com; path=/",
         "foo=bar; domain=.example.com; path=/"
     }));
     response.DeleteCookie("foo", new Response.Cookie { Domain = ".example.com" });
     Assert.That(response.GetHeaders("Set-Cookie"), Is.EquivalentTo(new[]
     {
         "foo=bar; domain=sample.example.com; path=/",
         "foo=; domain=.example.com; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"
     }));
     response.DeleteCookie("foo", new Response.Cookie { Domain = "sample.example.com" });
     Assert.That(response.GetHeaders("Set-Cookie"), Is.EquivalentTo(new[]
     {
         "foo=; domain=.example.com; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT",
         "foo=; domain=sample.example.com; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"
     }));
 }
Esempio n. 3
0
 public void ItCanDeleteCookiesWithTheSameNameWithDifferentPaths()
 {
     var response = new Response();
     response.SetCookie("foo", "bar");
     response.SetCookie("foo", new Response.Cookie { Value = "bar", Path = "/path" });
     Assert.That(response.GetHeaders("Set-Cookie"), Is.EquivalentTo(new[]
     {
         "foo=bar; path=/",
         "foo=bar; path=/path"
     }));
     response.DeleteCookie("foo", new Response.Cookie { Path = "/path" });
     Assert.That(response.GetHeaders("Set-Cookie"), Is.EquivalentTo(new[]
     {
         "foo=bar; path=/",
         "foo=; path=/path; expires=Thu, 01-Jan-1970 00:00:00 GMT"
     }));
 }