Exemplo n.º 1
0
 public void DoNotFailOnNonHTTPResponse()
 {
     using (var auth = new PersistentStandardAuthenticationProvider(this.storage.Object, this.url))
     {
         auth.HandleResponse(new Mock <WebResponse>().Object);
     }
 }
        public void SetCookieCollectionFilledWithCookiesOnDispose()
        {
            var cookie = new Cookie("name", "value", this.url.AbsolutePath, this.url.Host);

            using (var auth = new PersistentStandardAuthenticationProvider(this.storage.Object, this.url)) {
                auth.Cookies.Add(cookie);
            }

            this.storage.VerifySet(s => s.Cookies = It.Is <CookieCollection>(cc => cc.Count == 1 && cookie.Equals(cc[0])));
        }
        public void DeleteAllCookies()
        {
            using (var auth = new PersistentStandardAuthenticationProvider(this.storage.Object, this.url)) {
                auth.Cookies.Add(this.url, new Cookie("test", "value"));
                Assert.That(auth.Cookies.Count, Is.EqualTo(1));

                auth.DeleteAllCookies();
                Assert.That(auth.Cookies.Count, Is.EqualTo(0));
            }
        }