public void ShouldMakeFileSmallerWhenStreamIsCompressibleGifStream() { var optimizer = new ImageOptimizer(); AssertCompress(Files.FujiFilmFinePixS1ProGIF, true, (Stream stream) => { return(optimizer.LosslessCompress(stream)); }); }
public void ShouldThrowExceptionWhenFileNameIsNull() { var optimizer = new ImageOptimizer(); Assert.Throws <ArgumentNullException>("fileName", () => { optimizer.Compress((string)null); }); }
public void ShouldNotThrowExceptionWhenIgnoringUnsupportedFileName() { var optimizer = new ImageOptimizer { IgnoreUnsupportedFormats = true }; var compressionSuccess = optimizer.Compress(Files.InvitationTIF); Assert.False(compressionSuccess); }
public void ShouldThrowExceptionWhenFileIsNull() { var optimizer = new ImageOptimizer(); ExceptionAssert.Throws <ArgumentNullException>("file", () => { optimizer.IsSupported((FileInfo)null); }); }
public void ShouldNotMakeFileSmallerWhenFileIsUncompressibleIcoFile() { var optimizer = new ImageOptimizer(); AssertCompress(Files.ImageMagickICO, false, (FileInfo file) => { return(optimizer.Compress(file)); }); }
public void ShouldThrowExceptionWhenFileNameIsNull() { var optimizer = new ImageOptimizer(); ExceptionAssert.ThrowsArgumentNullException("fileName", () => { optimizer.IsSupported((string)null); }); }
public void ShouldThrowExceptionWhenStreamIsNull() { var optimizer = new ImageOptimizer(); ExceptionAssert.Throws <ArgumentNullException>("stream", () => { optimizer.IsSupported((Stream)null); }); }
public void ShouldNotMakeFileSmallerWhenStreamIsUncompressiblePngFile() { var optimizer = new ImageOptimizer(); AssertCompress(Files.MagickNETIconPNG, false, (Stream stream) => { return(optimizer.Compress(stream)); }); }
public void ShouldMakeFileSmallerWhenFileIsCompressibleIcoFile() { var optimizer = new ImageOptimizer(); AssertCompress(Files.WandICO, true, (FileInfo file) => { return(optimizer.Compress(file)); }); }
public void ShouldNotMakeFileSmallerWhenFileNameIsUncompressibleJpgFile() { var optimizer = new ImageOptimizer(); AssertCompress(Files.LetterJPG, false, (string fileName) => { return(optimizer.Compress(fileName)); }); }
public void ShouldMakeFileSmallerWhenStreamIsCompressibleIcoFile() { var optimizer = new ImageOptimizer(); AssertCompress(Files.WandICO, true, (Stream stream) => { return(optimizer.Compress(stream)); }); }
public void ShouldMakeFileSmallerWhenFileNameIsCompressiblePnggFile() { var optimizer = new ImageOptimizer(); AssertCompress(Files.SnakewarePNG, true, (string fileName) => { return(optimizer.Compress(fileName)); }); }
public void ShouldNotMakeFileSmallerWhenStreamIsCompressibleGifStream() { var optimizer = new ImageOptimizer(); AssertCompress(Files.RoseSparkleGIF, false, (Stream stream) => { return(optimizer.LosslessCompress(stream)); }); }
public void ShouldNotMakeFileSmallerWhenStreamIsCompressibleIcoStream() { var optimizer = new ImageOptimizer(); AssertCompress(Files.ImageMagickICO, false, (Stream stream) => { return(optimizer.LosslessCompress(stream)); }); }
public void ShouldThrowExceptionWhenFileIsNull() { var optimizer = new ImageOptimizer(); ExceptionAssert.ThrowsArgumentNullException("file", () => { optimizer.LosslessCompress((FileInfo)null); }); }
public void ShouldReturnFalseWhenStreamCannotRead() { var optimizer = new ImageOptimizer(); using (var stream = new TestStream(false, true, true)) { Assert.False(optimizer.IsSupported(stream)); } }
public void ShouldThrowExceptionWhenFileNameIsInvalid() { var optimizer = new ImageOptimizer(); ExceptionAssert.Throws <MagickBlobErrorException>(() => { optimizer.LosslessCompress(Files.Missing); }, "error/blob.c/OpenBlob"); }
public void ShouldThrowExceptionWhenFileIsUnsupportedFormat() { var optimizer = new ImageOptimizer(); ExceptionAssert.Throws <MagickCorruptImageErrorException>(() => { optimizer.LosslessCompress(Files.InvitationTIF); }, "Invalid format"); }
public void ShouldThrowExceptionWhenFileNameIsEmpty() { var optimizer = new ImageOptimizer(); ExceptionAssert.ThrowsArgumentException("fileName", () => { optimizer.IsSupported(string.Empty); }); }
public void ShouldMakeFileSmallerWhenFileNameIsCompressibleJpgFile() { var optimizer = new ImageOptimizer(); AssertCompress(Files.ImageMagickJPG, true, (string file) => { return(optimizer.LosslessCompress(file)); }); }
public void ShouldReturnFalseWhenStreamCannotSeek() { var optimizer = new ImageOptimizer(); using (TestStream stream = new TestStream(true, true, false)) { Assert.IsFalse(optimizer.IsSupported(stream)); } }
public void ShouldNotMakeFileSmallerWhenFileNameIsUncompressiblePngFile() { var optimizer = new ImageOptimizer(); AssertCompress(Files.MagickNETIconPNG, false, (string file) => { return(optimizer.LosslessCompress(file)); }); }
public void ShouldMakeFileSmallerWhenFileIsCompressibleGifFile() { var optimizer = new ImageOptimizer(); AssertCompress(Files.FujiFilmFinePixS1ProGIF, true, (FileInfo file) => { return(optimizer.Compress(file)); }); }
public void ShouldThrowExceptionWhenStreamIsNull() { var optimizer = new ImageOptimizer(); ExceptionAssert.ThrowsArgumentNullException("stream", () => { optimizer.LosslessCompress((Stream)null); }); }
public void ShouldNotMakeFileSmallerWhenFileIsUncompressibleGifFile() { var optimizer = new ImageOptimizer(); AssertCompress(Files.RoseSparkleGIF, false, (FileInfo file) => { return(optimizer.Compress(file)); }); }
public void ShouldMakeFileSmallerWhenStreamIsCompressiblePngFile() { var optimizer = new ImageOptimizer(); AssertCompress(Files.SnakewarePNG, true, (Stream file) => { return(optimizer.LosslessCompress(file)); }); }
public void ShouldThrowExceptionWhenFileNameIsEmpty() { var optimizer = new ImageOptimizer(); Assert.Throws <ArgumentException>("fileName", () => { optimizer.Compress(string.Empty); }); }
public void ShouldNotMakeFileSmallerWhenStreamIsCompressibleJpgFile() { var optimizer = new ImageOptimizer(); AssertCompress(Files.LetterJPG, false, (Stream file) => { return(optimizer.LosslessCompress(file)); }); }
public void ShouldMakeFileSmallerWhenStreamIsCompressibleJpgStrea() { var optimizer = new ImageOptimizer(); AssertCompress(Files.ImageMagickJPG, true, (Stream stream) => { return(optimizer.LosslessCompress(stream)); }); }
private static void Compress(string file) { ImageOptimizer optimizer = new ImageOptimizer() { OptimalCompression = true, IgnoreUnsupportedFormats = true }; optimizer.LosslessCompress(file); }