コード例 #1
0
ファイル: CookieTest.cs プロジェクト: coggy/plasma
        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"));
        }
コード例 #2
0
ファイル: WebBrowser.cs プロジェクト: coggy/plasma
 public ReadOnlyCollection <Cookie> GetAllCookies()
 {
     return(httpClient
            .GetAllCookies()
            .Select(x => new Cookie(x.Name, x.Value, x.Path, x.Expires))
            .ToList()
            .AsReadOnly());
 }
コード例 #3
0
ファイル: CookieTest.cs プロジェクト: coggy/plasma
        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);
        }