示例#1
0
        public void ShouldFetchHtml_AndPassToImageParser()
        {
            string testUrl = "www.test.blah";

            htmlRetriever.Stub(r => r.GetHtml(testUrl)).Return(GetTestHtml());

            downloader.Download(testUrl);

            parser.AssertWasCalled(p => p.Parse(GetTestHtml(), testUrl));
        }
        public void GivenUrl_ForAnHtmlPage_ShouldDownloadAllImages()
        {
            var downloader       = new SuperImageDownloader(new TestHtmlRetriever(), new ImageParser(), new ImageRetriever(new TestImageProvider(), new SystemThreadTaskHandler()));
            var downloadedImages = downloader.Download(UrlForTestHtmlPage);

            downloadedImages.ShouldMatch(GetImagesInTestHtmlPage());
        }