예제 #1
0
        public void op_Verify_CookieContainer_whenWrongStatus()
        {
            var cookies     = new CookieContainer();
            var expectation = new HttpExpectation
            {
                Exchange = new HttpExchange
                {
                    Request = new HttpRequest
                    {
                        Line = new HttpRequestLine("GET", "http://www.alan-dean.com/")
                    },
                    Response = new HttpResponse
                    {
                        Line = new HttpStatusLine(HttpStatusCode.OK)
                    }
                }
            };

            Assert.Throws <HttpTestException>(() => expectation.Verify(cookies));
        }
예제 #2
0
        public void op_Verify_CookieContainer()
        {
            var cookies     = new CookieContainer();
            var expectation = new HttpExpectation
            {
                Exchange = new HttpExchange
                {
                    Request = new HttpRequest
                    {
                        Line = new HttpRequestLine("GET", "http://www.alan-dean.com/")
                    },
                    Response = new HttpResponse
                    {
                        Line    = new HttpStatusLine(HttpStatusCode.SeeOther),
                        Headers = new HttpHeaderDictionary
                        {
                            new HttpHeader("Location", "http://www.alan-dean.com/about")
                        }
                    }
                }
            };

            Assert.True(expectation.Verify(cookies));
        }
예제 #3
0
        public void op_Verify_CookieContainer_whenWrongLocation()
        {
            var cookies     = new CookieContainer();
            var expectation = new HttpExpectation
            {
                Exchange = new HttpExchange
                {
                    Request = new HttpRequest
                    {
                        Line = new HttpRequestLine("GET", "http://www.alan-dean.com/")
                    },
                    Response = new HttpResponse
                    {
                        Line    = new HttpStatusLine(HttpStatusCode.SeeOther),
                        Headers = new HttpHeaderDictionary
                        {
                            new HttpHeader("Location", "http://www.alan-dean.com/example")
                        }
                    }
                }
            };

            Assert.Throws <HttpTestException>(() => expectation.Verify(cookies));
        }
예제 #4
0
        public void op_Verify_CookieContainer()
        {
            var cookies = new CookieContainer();
            var expectation = new HttpExpectation
                                  {
                                      Exchange = new HttpExchange
                                                     {
                                                         Request = new HttpRequest
                                                                       {
                                                                           Line = new HttpRequestLine("GET", "http://www.alan-dean.com/")
                                                                       },
                                                         Response = new HttpResponse
                                                                        {
                                                                            Line = new HttpStatusLine(HttpStatusCode.SeeOther),
                                                                            Headers = new HttpHeaderDictionary
                                                                                          {
                                                                                              new HttpHeader("Location", "http://www.alan-dean.com/about")
                                                                                          }
                                                                        }
                                                     }
                                  };

            Assert.True(expectation.Verify(cookies));
        }
예제 #5
0
        public void op_Verify_CookieContainer_whenWrongStatus()
        {
            var cookies = new CookieContainer();
            var expectation = new HttpExpectation
                                  {
                                      Exchange = new HttpExchange
                                                     {
                                                         Request = new HttpRequest
                                                                       {
                                                                           Line = new HttpRequestLine("GET", "http://www.alan-dean.com/")
                                                                       },
                                                         Response = new HttpResponse
                                                                        {
                                                                            Line = new HttpStatusLine(HttpStatusCode.OK)
                                                                        }
                                                     }
                                  };

            Assert.Throws<HttpTestException>(() => expectation.Verify(cookies));
        }
예제 #6
0
        public void op_Verify_CookieContainer_whenWrongLocation()
        {
            var cookies = new CookieContainer();
            var expectation = new HttpExpectation
                                  {
                                      Exchange = new HttpExchange
                                                     {
                                                         Request = new HttpRequest
                                                                       {
                                                                           Line = new HttpRequestLine("GET", "http://www.alan-dean.com/")
                                                                       },
                                                         Response = new HttpResponse
                                                                        {
                                                                            Line = new HttpStatusLine(HttpStatusCode.SeeOther),
                                                                            Headers = new HttpHeaderDictionary
                                                                                          {
                                                                                              new HttpHeader("Location", "http://www.alan-dean.com/example")
                                                                                          }
                                                                        }
                                                     }
                                  };

            Assert.Throws<HttpTestException>(() => expectation.Verify(cookies));
        }