Ejemplo n.º 1
0
        public void ShouldAcceptCookiesSetByTheHost()
        {
            var client = new HttpPlasmaClient(TestFixture.Application);

            var response = client.Get("/Cookies/Set");

            Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            Assert.That(client.GetAllCookies().Any(x => x.Name == "Test"), Is.True);
            Assert.That(client.GetAllCookies().First(x => x.Name == "Test").Value, Is.StringContaining("Cookie Set By Host"));
        }
Ejemplo n.º 2
0
 public ReadOnlyCollection <Cookie> GetAllCookies()
 {
     return(httpClient
            .GetAllCookies()
            .Select(x => new Cookie(x.Name, x.Value, x.Path, x.Expires))
            .ToList()
            .AsReadOnly());
 }
Ejemplo n.º 3
0
        public void ShouldExpireCookiesThatAreSetByTheHostIntoThePast()
        {
            var value  = Guid.NewGuid().ToString();
            var client = new HttpPlasmaClient(TestFixture.Application);

            client.AddCookie(new Cookie("test", value));

            var response = client.Get("/Cookies/Expire");

            Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            Assert.That(client.GetAllCookies().Any(), Is.False);
        }