public void ShouldDowloandPageTest() { var linkRepo = Substitute.For <ILinksRepo>(); var webRepo = Substitute.For <IWebRepo>(); LinkProcessingService linkProcessingService = new LinkProcessingService(linkRepo, webRepo); var testUrl = "Resource\\Mummia.html"; HtmlDocument html = new HtmlDocument { Text = File.ReadAllText(testUrl) }; webRepo.DowloandPage(testUrl).Returns(html); var checkFile = linkProcessingService.DowloandPage(testUrl); webRepo.Received(1).DowloandPage(testUrl); Assert.AreEqual(checkFile, html); }