Ejemplo n.º 1
0
                public void ShouldThrowExceptionWhenInitializedWithCustomPolicyThatDisablesReadingPalmFiles()
                {
                    using (var tempFile = new TemporaryFile("test.palm"))
                    {
                        using (var fs = tempFile.OpenWrite())
                        {
                            var bytes = new byte[4] {
                                0, 0, 0, 0
                            };
                            fs.Write(bytes, 0, bytes.Length);
                        }

                        Assert.Throws <MagickPolicyErrorException>(() =>
                        {
                            using (var image = new MagickImage(tempFile))
                            {
                            }
                        });
                    }
                }
Ejemplo n.º 2
0
        public void InitializedWithCustomPolicy_ReadPalmFile_ThrowsException()
        {
            using (TemporaryFile tempFile = new TemporaryFile("test.palm"))
            {
                using (FileStream fs = tempFile.OpenWrite())
                {
                    byte[] bytes = new byte[4] {
                        255, 255, 255, 255
                    };
                    fs.Write(bytes, 0, bytes.Length);
                }

                ExceptionAssert.Throws <MagickPolicyErrorException>(() =>
                {
                    using (MagickImage image = new MagickImage(tempFile))
                    {
                    }
                });
            }
        }