Exemplo n.º 1
0
        public void WhenRunIsCalledAndScreenshotsMatchThenItReturnsAPositiveResult()
        {
            var screenshotTestEngineBuilder = new ScreenshotTestEngineBuilder()
                                              .WithOldFilePath(@"OldImages/pic.png")
                                              .WithNewFilePath(@"NewImages/pic.png")
                                              .WhereImagesMatch();

            var sut = screenshotTestEngineBuilder.Build();

            var screenshotTestBuilder = new ScreenshotTestBuilder()
                                        .WithFileName("pic.png")
                                        .WithUrl("DemoPage.html");

            var result = sut.Run(screenshotTestBuilder.Build());

            Assert.IsTrue(result.Passed);
        }
Exemplo n.º 2
0
        public void WhenRunIsCalledThenItCallsSaveScreenshotOnTestEngineBuilder()
        {
            var screenshotTestEngineBuilder = new ScreenshotTestEngineBuilder()
                                              .WithOldFilePath(@"OldImages/pic.png")
                                              .WithNewFilePath(@"NewImages/pic.png");

            var sut = screenshotTestEngineBuilder.Build();

            var screenshotTestBuilder = new ScreenshotTestBuilder()
                                        .WithFileName("pic.png")
                                        .WithUrl("DemoPage.html");

            sut.Run(screenshotTestBuilder.Build());

            screenshotTestEngineBuilder.MockScreenshotProvider.Verify(x =>
                                                                      x.SaveScreenshot(screenshotTestBuilder.Url, @"NewImages/pic.png"), Times.Once);
        }