public async void Can_download_sample_from_github()
        {
            string url = "https://stho32.github.io/website-validator/can_download_sample.html";

            var downloader = new DownloadAWebpage();

            var result = await downloader.Download(url);

            Assert.Equal(HttpStatusCode.OK, result.HttpCode);
            Assert.Contains("automated test", result.RawContent);
        }
Пример #2
0
        private static void ListLinksForUrl(string url)
        {
            IDownloadAWebpage downloadWebpage = new DownloadAWebpage();
            IUrlExtractor     extractor       = new HtmlAgilityBasedUrlExtractor();

            var website = downloadWebpage.Download(url);
            var links   = extractor.ExtractUrls(website.Result.RawContent);

            for (var index = 0; index < links.Length; index++)
            {
                var link = links[index];
                Console.WriteLine($"{index,4}. {link}");
            }
        }