Example #1
0
        public void Test_Unregister()
        {
            MagickFormatInfo formatInfo = MagickNET.GetFormatInformation(MagickFormat.X3f);

            Assert.IsNotNull(formatInfo);
            Assert.IsTrue(formatInfo.Unregister());

            var settings = new MagickReadSettings()
            {
                Format = MagickFormat.X3f,
            };

            ExceptionAssert.Throws <MagickMissingDelegateErrorException>(() =>
            {
                var image = new MagickImage();
                image.Read(new byte[] { 1, 2, 3, 4 }, settings);
            });
        }
Example #2
0
        public void Test_Unregister()
        {
            using (MagickImage image = new MagickImage(Files.SnakewarePNG))
            {
                using (MemoryStream memoryStream = new MemoryStream())
                {
                    image.Resize(256, 256);
                    image.Format = MagickFormat.Ico;
                    image.Write(memoryStream);
                    memoryStream.Position = 0;

                    MagickFormatInfo formatInfo = MagickNET.GetFormatInformation(MagickFormat.Ico);
                    Assert.IsNotNull(formatInfo);
                    Assert.IsTrue(formatInfo.Unregister());

                    ExceptionAssert.Throws <MagickMissingDelegateErrorException>(delegate()
                    {
                        new MagickImage(memoryStream);
                    });
                }
            }
        }