public void WhenCalling_ApplyTransforms_WithImageType_Should_ReturnImageWithCorrectImageFormat(string imageTypeParameter, string expectedImageFormatName) { var sut = new ImageTransformer(); var testImage = new Image("01_04_2019_001103", TestHelpers.GetTestImage()); var result = sut.ApplyTransforms(testImage, imageType: imageTypeParameter); result.ToGdiImage().RawFormat.ToString().Should().BeEquivalentTo(expectedImageFormatName); }
public void WhenCalling_ApplyTransforms_WithNoTransforms_Should_ReturnOriginalImage() { var sut = new ImageTransformer(); var testImage = new Image("01_04_2019_001103", TestHelpers.GetTestImage()); var result = sut.ApplyTransforms(testImage); result.Name.Should().BeEquivalentTo("01_04_2019_001103"); TestHelpers.CompareImages(result.ToGdiImage(), TestHelpers.GetTestImage()).Should().Be(CompareResult.Same); }
public void WhenCalling_ApplyTransforms_WithWatermarkText_Should_ReturnImageWithWatermark() { var sut = new ImageTransformer(); var testImage = new Image("01_04_2019_001103", TestHelpers.GetTestImage(width: 1000, height: 600)); var result = sut.ApplyTransforms(testImage, watermarkText: "Some watermark text"); var expectedGdiImage = TestHelpers.GetTestImage(width: 1000, height: 600, watermark: "Some watermark text"); TestHelpers.CompareImages(result.ToGdiImage(), expectedGdiImage).Should().Be(CompareResult.Same); }
public void WhenCalling_ApplyTransforms_WithBackgroundColour_Should_ReturnImageWithCorrectBackgroundColour(string backgroundColourParameter, string expectedBackgroundColour) { var sut = new ImageTransformer(); var testImage = new Image("01_04_2019_001103", TestHelpers.GetTestImage(makeTransparent: true)); var result = sut.ApplyTransforms(testImage, backgroundColour: backgroundColourParameter); var expectedGdiImage = TestHelpers.GetTestImage(GDI.Color.FromName(expectedBackgroundColour)); TestHelpers.CompareImages(result.ToGdiImage(), expectedGdiImage).Should().Be(CompareResult.Same); }
public void WhenCalling_ApplyTransforms_WithResolution_Should_ReturnImageWithCorrectResolution(string resolutionParameter, int expectedWidth, int expectedHeight) { var sut = new ImageTransformer(); var testImage = new Image("01_04_2019_001103", TestHelpers.GetTestImage()); var result = sut.ApplyTransforms(testImage, resolutionParameter); result.ToGdiImage().Width.Should().Be(expectedWidth); result.ToGdiImage().Height.Should().Be(expectedHeight); result.ToGdiImage().RawFormat.Should().Be(TestHelpers.GetTestImage().RawFormat); }