示例#1
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);
        }
示例#2
0
        public void ShouldBeAbleToSendCookiesToHost()
        {
            var value  = Guid.NewGuid().ToString();
            var client = new HttpPlasmaClient(TestFixture.Application);

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

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

            Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            Assert.That(response.GetBody(), Is.StringContaining(value));
        }
示例#3
0
 public void AddCookie(Cookie cookie)
 {
     httpClient.AddCookie(new System.Net.Cookie(cookie.Name, cookie.Value));
 }