Пример #1
0
        public void CreateCollection_WithFileNameAndSettings_ReturnsMagickImageCollection()
        {
            var readSettings = new MagickReadSettings
            {
                BackgroundColor = MagickColors.Firebrick,
            };

            MagickFactory factory = new MagickFactory();

            using (IMagickImageCollection collection = factory.CreateCollection(Files.RoseSparkleGIF, readSettings))
            {
                Assert.IsInstanceOfType(collection, typeof(MagickImageCollection));
                Assert.AreEqual(3, collection.Count);
                Assert.AreEqual(MagickColors.Firebrick, collection.First().Settings.BackgroundColor);
            }
        }
Пример #2
0
        public void CreateCollection_IEnumerableImages_ReturnsMagickImageCollection()
        {
            var image  = new MagickImage(Files.ImageMagickJPG);
            var images = new MagickImage[] { image };

            MagickFactory factory = new MagickFactory();

            using (IMagickImageCollection collection = factory.CreateCollection(images))
            {
                Assert.IsInstanceOfType(collection, typeof(MagickImageCollection));
                Assert.AreEqual(1, collection.Count);
                Assert.AreEqual(image, collection.First());
            }

            ExceptionAssert.Throws <ObjectDisposedException>(() =>
            {
                Assert.IsFalse(image.HasAlpha);
            });
        }