コード例 #1
0
        public void FetchPreviewFromHtml_FailsOnInvalidData()
        {
            var urlPreview = new UrlPreview();

            var result1 = urlPreview.FetchPreviewFromHtml(null as string);

            Assert.Null(result1);

            var result2 = urlPreview.FetchPreviewFromHtml(null as HtmlDocument);

            Assert.Null(result2);
        }
コード例 #2
0
        public void FetchPreviewFromHtml_SuccessOnMultipleFiles()
        {
            var urlPreview = new UrlPreview();

            const string fileName1 = "./Resources/CNN - Tapping into craft beer's online potential.html";

            using (var fileStream = new FileStream(fileName1, FileMode.Open))
            {
                using (var reader = new StreamReader(fileStream))
                {
                    var result = urlPreview.FetchPreviewFromHtml(reader.ReadToEnd());
                    Assert.NotNull(result);
                }
            }

            const string fileName2 = "Fox Business - Stocks jump on final trading day of 2Q.html";
            const string fileName3 = "Twitter - A Microsoft Tweet.html";
            const string fileName4 = "Wikipedia - Hayabusa2.html";
        }