Пример #1
0
            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);
                }
            }
Пример #2
0
                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);
                        });
                    }
                }
Пример #4
0
            public void ShouldThrowExceptionWhenStreamIsTooLong()
            {
                using (var stream = new TestStream(true, true, true))
                {
                    stream.SetLength(long.MaxValue);

                    Assert.Throws <ArgumentException>("length", () =>
                    {
                        new Bytes(stream);
                    });
                }
            }
Пример #5
0
        public void Constructor_StreamIsTooLong_ThrowsException()
        {
            using (TestStream stream = new TestStream(true, true, true))
            {
                stream.SetLength(long.MaxValue);

                ExceptionAssert.ThrowsArgumentException("length", () =>
                {
                    new Bytes(stream);
                });
            }
        }
Пример #6
0
 public void ShouldThrowExceptionWhenStreamIsNotReadable()
 {
     using (TestStream testStream = new TestStream(false, true, true))
     {
         using (IMagickImage image = new MagickImage())
         {
             ExceptionAssert.Throws <ArgumentException>("stream", () =>
             {
                 image.Ping(testStream);
             });
         }
     }
 }