예제 #1
0
        public async Task DownloadPage(string page)
        {
            Console.WriteLine($"\tDownload {page}");

            string response = await wiki.GetHtmlAsync(page);

            await file.SaveToFileAsync(page, response);
        }
예제 #2
0
        public void ShouldDownloadPage()
        {
            // Arrange
            linkService = new LinksServices(db, file, wiki);

            string page = "page_name";

            wiki.GetHtmlAsync(page).Returns("http page");;

            // Act
            linkService.DownloadPage(page).Wait();

            // Assert
            wiki.Received(1).GetHtmlAsync(page);
            file.Received(1).SaveToFileAsync(page, "http page");
        }