public void WhenRunIsCalledThenScreenshotEngineTakesASnapshotForEachUrl() { var mockScreenshotProvider = new Mock <IScreenshotProvider>(); var filePathProvider = new FilePathProvider("TestDirectory"); var sut = new ScreenshotRunner(mockScreenshotProvider.Object, filePathProvider); var screenshotDefinitions = new[] { new ScreenshotDefinition("url1", "fileName1"), new ScreenshotDefinition("url2", "fileName2") }; sut.CreateScreenshots(screenshotDefinitions); mockScreenshotProvider.Verify(x => x.SaveScreenshot("url1", @"TestDirectory\fileName1"), Times.Once); mockScreenshotProvider.Verify(x => x.SaveScreenshot("url2", @"TestDirectory\fileName2"), Times.Once); }
public void RunTests() { var screenshots = new[] { new ScreenshotDefinition( @"http://www.thelondonclinic.co.uk/patient-care/your-stay-at-the-london-clinic", "Your_Stay.png"), new ScreenshotDefinition(@"http://www.thelondonclinic.co.uk/eye-centre", "Eye_Centre.png") }; var oldFilePath = new FilePathProvider("Original"); var newFilePath = new FilePathProvider("New"); var screenshotProvider = new ScreenshotProvider(new ChromeDriver(@"Drivers/")); var runner = new ScreenshotRunner(screenshotProvider, oldFilePath); runner.CreateScreenshots(screenshots); var screenshotEngine = new ScreenshotTestEngine(oldFilePath, newFilePath, screenshotProvider); var testRunner = new ScreenshotTestRunner(screenshotEngine, screenshots); var results = testRunner.Run(); }