public void ShouldThrowExceptionWhenStreamIsNotReadable() { using (TestStream stream = new TestStream(false, true, true)) { var exception = Assert.Throws <ArgumentException>("stream", () => { StreamWrapper.CreateForReading(stream); }); Assert.Contains("readable", exception.Message); } }
public void ShouldThrowExceptionWhenStreamCannotSeek() { var optimizer = new ImageOptimizer(); using (TestStream stream = new TestStream(true, true, false)) { ExceptionAssert.Throws <ArgumentException>("stream", () => { optimizer.Compress(stream); }); } }
public void ShouldThrowExceptionWhenStreamCannotWrite() { var optimizer = new ImageOptimizer(); using (var stream = new TestStream(true, false, true)) { Assert.Throws <ArgumentException>("stream", () => { optimizer.LosslessCompress(stream); }); } }
public void ShouldThrowExceptionWhenStreamIsTooLong() { using (var stream = new TestStream(true, true, true)) { stream.SetLength(long.MaxValue); Assert.Throws <ArgumentException>("length", () => { new Bytes(stream); }); } }
public void Constructor_StreamIsTooLong_ThrowsException() { using (TestStream stream = new TestStream(true, true, true)) { stream.SetLength(long.MaxValue); ExceptionAssert.ThrowsArgumentException("length", () => { new Bytes(stream); }); } }
public void ShouldThrowExceptionWhenStreamIsNotReadable() { using (TestStream testStream = new TestStream(false, true, true)) { using (IMagickImage image = new MagickImage()) { ExceptionAssert.Throws <ArgumentException>("stream", () => { image.Ping(testStream); }); } } }