Beispiel #1
0
                public void ShouldThrowExceptionWhenHeightIsZero()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("height", () =>
                    {
                        factory.CreateImage(MagickColors.Red, 1, 0);
                    });
                }
Beispiel #2
0
                public void ShouldThrowExceptionWhenArrayIsEmpty()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("data", () =>
                    {
                        factory.CreateImage(new byte[] { });
                    });
                }
Beispiel #3
0
                public void ShouldThrowExceptionWhenColorIsNull()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentNullException>("color", () =>
                    {
                        factory.CreateImage((MagickColor)null, 1, 1);
                    });
                }
Beispiel #4
0
                public void ShouldThrowExceptionWhenWidthIsZero()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("width", () =>
                    {
                        factory.CreateImage(MagickColors.Red, 0, 1);
                    });
                }
Beispiel #5
0
                public void ShouldThrowExceptionWhenFileInfoIsNull()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentNullException>("fileName", () =>
                    {
                        factory.CreateImage((string)null);
                    });
                }
Beispiel #6
0
                public void ShouldThrowExceptionWhenArrayIsNull()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentNullException>("data", () =>
                    {
                        factory.CreateImage((byte[])null, 0, 0);
                    });
                }
Beispiel #7
0
            public void ShouldReturnTheSameInstance()
            {
                var factory = new MagickFactory();

                var first  = factory.Drawables;
                var second = factory.Drawables;

                Assert.AreSame(first, second);
            }
Beispiel #8
0
                public void ShouldThrowExceptionWhenWidthIsNegative()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("width", () =>
                    {
                        factory.CreateImage("xc:red", -1, 1);
                    });
                }
Beispiel #9
0
                public void ShouldThrowExceptionWhenStreamIsEmpty()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("stream", () =>
                    {
                        factory.CreateCollection(new MemoryStream());
                    });
                }
Beispiel #10
0
                public void ShouldThrowExceptionWhenOffsetIsNegative()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("offset", () =>
                    {
                        factory.CreateCollection(new byte[] { 215 }, -1, 0);
                    });
                }
Beispiel #11
0
                public void ShouldThrowExceptionWhenStreamIsNull()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentNullException>("stream", () =>
                    {
                        factory.CreateCollection((Stream)null);
                    });
                }
Beispiel #12
0
                public void ShouldNotThrowExceptionWhenSettingsIsNull()
                {
                    IMagickFactory factory = new MagickFactory();

                    using (IMagickImageCollection images = factory.CreateCollection(Files.CirclePNG, null))
                    {
                        Assert.IsInstanceOfType(images, typeof(MagickImageCollection));
                    }
                }
Beispiel #13
0
                public void ShouldCreateMagickImage()
                {
                    IMagickFactory factory = new MagickFactory();

                    using (IMagickImageCollection images = factory.CreateCollection(Files.ImageMagickJPG))
                    {
                        Assert.IsInstanceOfType(images, typeof(MagickImageCollection));
                    }
                }
Beispiel #14
0
                public void ShouldThrowExceptionWhenFileInfoIsNull()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentNullException>("file", () =>
                    {
                        factory.CreateCollection((FileInfo)null);
                    });
                }
            public void ShouldReturnTheSameInstance()
            {
                var factory = new MagickFactory();

                var first  = factory.Image;
                var second = factory.Image;

                Assert.Same(first, second);
            }
Beispiel #16
0
                public void ShouldThrowExceptionWhenSettingsIsNull()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentNullException>("settings", () =>
                    {
                        factory.CreateImage(new FileInfo(Files.CirclePNG), (PixelReadSettings)null);
                    });
                }
Beispiel #17
0
                public void ShouldThrowExceptionWhenCountIsNegative()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("count", () =>
                    {
                        factory.CreateImage(new byte[] { 215 }, 0, -1);
                    });
                }
Beispiel #18
0
                public void ShouldThrowExceptionWhenHeightIsNegative()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("height", () =>
                    {
                        factory.CreateImage("xc:red", 1, -1);
                    });
                }
Beispiel #19
0
                public void ShouldNotThrowExceptionWhenSettingsIsNull()
                {
                    IMagickFactory factory = new MagickFactory();
                    var            bytes   = File.ReadAllBytes(Files.CirclePNG);

                    using (var image = factory.CreateImage(bytes, 0, bytes.Length, (MagickReadSettings)null))
                    {
                    }
                }
Beispiel #20
0
                public void ShouldThrowExceptionWhenFileNameIsEmpty()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("fileName", () =>
                    {
                        factory.CreateImage(string.Empty);
                    });
                }
Beispiel #21
0
                public void ShouldNotThrowExceptionWhenSettingsIsNull()
                {
                    IMagickFactory factory = new MagickFactory();

                    using (IMagickImage image = factory.CreateImage(new FileInfo(Files.CirclePNG), (MagickReadSettings)null))
                    {
                        Assert.IsInstanceOfType(image, typeof(MagickImage));
                    }
                }
Beispiel #22
0
                public void ShouldThrowExceptionWhenCountIsZero()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("count", () =>
                    {
                        factory.CreateCollection(new byte[] { 215 }, 0, 0);
                    });
                }
Beispiel #23
0
            public void ShouldHaveTheCorrectDephValue()
            {
                var factory = new MagickFactory();

#if Q8
                Assert.Equal(8, factory.QuantumInfo.Depth);
#else
                Assert.Equal(16, factory.QuantumInfo.Depth);
#endif
            }
Beispiel #24
0
                public void ShouldCreateMagickImage()
                {
                    IMagickFactory factory = new MagickFactory();
                    var            file    = new FileInfo(Files.ImageMagickJPG);

                    IMagickImageInfo info = factory.CreateImageInfo(file);

                    Assert.IsInstanceOfType(info, typeof(MagickImageInfo));
                    Assert.AreEqual(123, info.Width);
                }
Beispiel #25
0
                public void ShouldCreateMagickImage()
                {
                    IMagickFactory factory = new MagickFactory();
                    var            data    = File.ReadAllBytes(Files.ImageMagickJPG);

                    IMagickImageInfo info = factory.CreateImageInfo(data);

                    Assert.IsInstanceOfType(info, typeof(MagickImageInfo));
                    Assert.AreEqual(123, info.Width);
                }
        public void CreateImageInfo_WithFileInfo_ReturnsMagickImageInfo()
        {
            var file = new FileInfo(Files.ImageMagickJPG);

            MagickFactory    factory   = new MagickFactory();
            IMagickImageInfo imageInfo = factory.CreateImageInfo(file);

            Assert.IsInstanceOfType(imageInfo, typeof(MagickImageInfo));
            Assert.AreEqual(123, imageInfo.Width);
        }
        public void CreateImageInfo_WithBytes_ReturnsMagickImageInfo()
        {
            var data = File.ReadAllBytes(Files.ImageMagickJPG);

            MagickFactory    factory   = new MagickFactory();
            IMagickImageInfo imageInfo = factory.CreateImageInfo(data);

            Assert.IsInstanceOfType(imageInfo, typeof(MagickImageInfo));
            Assert.AreEqual(123, imageInfo.Width);
        }
        public void CreateImage_WithFileName_ReturnsMagickImage()
        {
            MagickFactory factory = new MagickFactory();

            using (IMagickImage image = factory.CreateImage(Files.ImageMagickJPG))
            {
                Assert.IsInstanceOfType(image, typeof(MagickImage));
                Assert.AreEqual(123, image.Width);
            }
        }
        public void CreateCollection_ReturnsMagickImageCollection()
        {
            MagickFactory factory = new MagickFactory();

            using (IMagickImageCollection collection = factory.CreateCollection())
            {
                Assert.IsInstanceOfType(collection, typeof(MagickImageCollection));
                Assert.AreEqual(0, collection.Count);
            }
        }
        public void CreateImage_ReturnsMagickImage()
        {
            MagickFactory factory = new MagickFactory();

            using (IMagickImage image = factory.CreateImage())
            {
                Assert.IsInstanceOfType(image, typeof(MagickImage));
                Assert.AreEqual(0, image.Width);
            }
        }