From 292d8e0dac5aba136fd1010517c2ae42d6c90bd3 Mon Sep 17 00:00:00 2001 From: Denis Nutiu Date: Tue, 25 Jan 2022 22:57:40 +0200 Subject: [PATCH] Implement tests for MetadataRemover --- ImageCore.Tests/TestMetadataRemover.cs | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 ImageCore.Tests/TestMetadataRemover.cs diff --git a/ImageCore.Tests/TestMetadataRemover.cs b/ImageCore.Tests/TestMetadataRemover.cs new file mode 100644 index 0000000..f0986e1 --- /dev/null +++ b/ImageCore.Tests/TestMetadataRemover.cs @@ -0,0 +1,28 @@ +using Image.Compressor; +using Image.Remover; +using ImageMagick; +using Moq; +using Xunit; + +namespace ImageCore.Tests +{ + public class TestMetadataRemover + { + [Fact] + public void TestCleanImage() + { + // Setup + var magicImageMock = new Mock(); + var compressorMock = new Mock(); + var metadataRemover = new ExifMetadataRemoverAndCompressor(magicImageMock.Object, compressorMock.Object); + + // Test + metadataRemover.CleanImage("path"); + + // Assert + magicImageMock.Verify( i => i.RemoveProfile("exif")); + magicImageMock.Verify( i => i.Write("path")); + compressorMock.Verify( i => i.Compress("path")); + } + } +} \ No newline at end of file