public void QuantizationWillMakeOriginalPngSmaller()
        {
            var config = new Mock<IRRConfiguration>();
            var optimizer = new PngOptimizer(new FileWrapper(), config.Object, new WuQuantizer());
            var original = File.ReadAllBytes("testimages\\menu-sprite.png");

            var result = optimizer.OptimizePng(original, 0, false);

            Assert.True(result.Length < original.Length);
        }
        public void CompressionWillMakeOriginalPngSmaller()
        {
            var config = new Mock<IRRConfiguration>();
            config.Setup(x => x.ResourcePhysicalPath).Returns("testimages");
            var optimizer = new PngOptimizer(new FileWrapper(), config.Object, new WuQuantizer());
            var original = File.ReadAllBytes("testimages\\menu-sprite.png");

            var result = optimizer.OptimizePng(original, 5, true);

            Assert.True(result.Length < original.Length);
        }
        public void WillNotAlterOriginalImage()
        {
            var config = new Mock<IRRConfiguration>();
            config.Setup(x => x.ResourcePhysicalPath).Returns("testimages");
            var optimizer = new PngOptimizer(new FileWrapper(), config.Object, new WuQuantizer());
            var original = File.ReadAllBytes("testimages\\menu-sprite.png");

            optimizer.OptimizePng(original, 5, false);

            Assert.Equal(original.Length, File.ReadAllBytes("testimages\\menu-sprite.png").Length);
        }
        public void WillCleanupScratchFile()
        {
            var config = new Mock<IRRConfiguration>();
            config.Setup(x => x.ResourcePhysicalPath).Returns("testimages");
            var optimizer = new PngOptimizer(new FileWrapper(), config.Object, new WuQuantizer());
            var original = File.ReadAllBytes("testimages\\menu-sprite.png");
            var fileCount = Directory.GetFiles("testimages").Length;

            optimizer.OptimizePng(original, 5, true);

            Assert.Equal(fileCount, Directory.GetFiles("testimages").Length);
        }