public void ReadResponse_Should_Return_Null_For_Invalid_Url()
        {
            const string Response = "Test Response";

            Mock <WebRequest> request = MockRequest(Response);

            request.Expect(r => r.GetResponse()).Throws <WebException>();

            var result = HttpForm.ReadResponse(request.Object);

            Assert.Null(result);
        }
Example #2
0
        public void ReadResponse_Should_Return_Correct_Response()
        {
            const string Response = "Test Response";

            Mock <WebRequest> request = MockRequest(Response);

            request.Setup(r => r.GetResponse()).Throws <WebException>();

            var result = HttpForm.ReadResponse(request.Object);

            Assert.Null(result.Response);
        }