Alx.Web.Tests.ScreenshotTests.GivenSpecificSize_SaveScreenshot_ShouldReturnImageWithCorrectSize C# (CSharp) Method

GivenSpecificSize_SaveScreenshot_ShouldReturnImageWithCorrectSize() private method

        public void GivenSpecificSize_SaveScreenshot_ShouldReturnImageWithCorrectSize()
        {
            // Arrange
            const string url = "https://www.google.co.uk";
            const string path = @"C:\Temp\screenshot_1000x800.png";
            var format = ImageFormat.Png;
            var size = new Size(1000, 800);

            if (File.Exists(path))
            {
                File.Delete(path);
            }

            // Act
            Screenshot.Save(url, path, format, size);

            // Assert
            Assert.IsTrue(File.Exists(path));
            var image = Image.FromFile(path);
            Assert.IsNotNull(image);
            Assert.AreEqual(size.Width, image.Width);
            Assert.AreEqual(size.Height, image.Height);
        }
    }