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")); }
public ReadOnlyCollection <Cookie> GetAllCookies() { return(httpClient .GetAllCookies() .Select(x => new Cookie(x.Name, x.Value, x.Path, x.Expires)) .ToList() .AsReadOnly()); }
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); }