public void ShouldRecursiveExit() { var linkRepo = Substitute.For <ILinksRepo>(); var webRepo = Substitute.For <IWebRepo>(); LinkProcessingService linkProcessingService = new LinkProcessingService(linkRepo, webRepo); linkProcessingService.ParsingForEachPage(0); linkRepo.GetAllWithIteration(0).DidNotReceive(); }
public void ShouldParsingForEachPage() { var linkRepo = Substitute.For <ILinksRepo>(); var webRepo = Substitute.For <IWebRepo>(); LinkProcessingService linkProcessingService = new LinkProcessingService(linkRepo, webRepo); List <string> Urls = new List <string> { "https://en.wikipedia.org/wiki/Trololo" }; linkRepo.GetAllWithIteration(0).Returns(Urls); HtmlDocument html = new HtmlDocument(); webRepo.DowloandPage(Urls[0]).Returns(html); webRepo.GetAllTagsFromPage(html).Returns(new List <string> { "/wiki/Mumu", "https://ru.wikipedia.org/wiki/Ruru", "https://en.wikipedia.org/wiki/Trololo", "/wiki/LoLo" }); linkProcessingService.ParsingForEachPage(2); linkRepo.GetAllWithIteration(1).Received(1); }