コード例 #1
0
        public void Test_When_Invalid_Url()
        {
            IUrlContentReader reader = new UrlContentReader();

            Assert.ThrowsException <UriFormatException>(() => {
                var result = reader.Read("helloworld");
            });
        }
コード例 #2
0
        public void Test_When_Non_Existent_Url()
        {
            IUrlContentReader reader = new UrlContentReader();

            Assert.ThrowsException <WebException>(() => {
                var result = reader.Read("http://googlenotexists123.com");
            });
        }
コード例 #3
0
        public void Test_When_Valid_Url()
        {
            IUrlContentReader reader = new UrlContentReader();
            var result = reader.Read("http://google.com");

            Assert.AreEqual(200, result.ResponseCode);
            Assert.IsTrue(result.ResponseTime > 0.0);
            Assert.IsTrue(result.Html.Length > 0);
        }