Exemplo n.º 1
0
 public void Test_ReadExceptions()
 {
     using (FileStream fs = File.OpenRead(Files.ImageMagickJPG))
     {
         using (ReadExceptionStream stream = new ReadExceptionStream(fs))
         {
             using (IMagickImage image = new MagickImage())
             {
                 ExceptionAssert.Throws <MagickMissingDelegateErrorException>(() =>
                 {
                     image.Read(stream);
                 });
             }
         }
     }
 }
Exemplo n.º 2
0
            public unsafe void ShouldNotThrowExceptionWhenWhenStreamThrowsExceptionDuringReading()
            {
                using (var memStream = new MemoryStream())
                {
                    using (var stream = new ReadExceptionStream(memStream))
                    {
                        using (var streamWrapper = StreamWrapper.CreateForReading(stream))
                        {
                            byte[] buffer = new byte[10];
                            fixed(byte *p = buffer)
                            {
                                int count = streamWrapper.Read((IntPtr)p, (UIntPtr)10, IntPtr.Zero);

                                Assert.AreEqual(-1, count);
                            }
                        }
                    }
                }
            }