public void CreateImageInfo_WithFileName_ReturnsMagickImageInfo()
        {
            MagickFactory    factory   = new MagickFactory();
            IMagickImageInfo imageInfo = factory.CreateImageInfo(Files.ImageMagickJPG);

            Assert.IsInstanceOfType(imageInfo, typeof(MagickImageInfo));
            Assert.AreEqual(123, imageInfo.Width);
        }
示例#2
0
            public void ShouldCreateMagickImageInfo()
            {
                IMagickFactory   factory = new MagickFactory();
                IMagickImageInfo info    = factory.CreateImageInfo();

                Assert.IsInstanceOfType(info, typeof(MagickImageInfo));
                Assert.AreEqual(0, info.Width);
            }
        public void CreateImageInfo_ReturnsMagickImageInfo()
        {
            MagickFactory    factory   = new MagickFactory();
            IMagickImageInfo imageInfo = factory.CreateImageInfo();

            Assert.IsInstanceOfType(imageInfo, typeof(MagickImageInfo));
            Assert.AreEqual(0, imageInfo.Width);
        }
示例#4
0
                public void ShouldThrowExceptionWhenOffsetIsNegative()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("offset", () =>
                    {
                        factory.CreateImageInfo(new byte[] { 215 }, -1, 0);
                    });
                }
示例#5
0
                public void ShouldThrowExceptionWhenFileNameIsEmpty()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("fileName", () =>
                    {
                        factory.CreateImageInfo(string.Empty);
                    });
                }
示例#6
0
                public void ShouldThrowExceptionWhenArrayIsNull()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentNullException>("data", () =>
                    {
                        factory.CreateImageInfo(null, 0, 0);
                    });
                }
示例#7
0
                public void ShouldThrowExceptionWhenArrayIsEmpty()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("data", () =>
                    {
                        factory.CreateImageInfo(new byte[] { }, 0, 0);
                    });
                }
示例#8
0
                public void ShouldThrowExceptionWhenStreamIsEmpty()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("stream", () =>
                    {
                        factory.CreateImageInfo(new MemoryStream());
                    });
                }
示例#9
0
                public void ShouldThrowExceptionWhenFileInfoIsNull()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentNullException>("fileName", () =>
                    {
                        factory.CreateImageInfo((string)null);
                    });
                }
示例#10
0
                public void ShouldThrowExceptionWhenStreamIsNull()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentNullException>("stream", () =>
                    {
                        factory.CreateImageInfo((Stream)null);
                    });
                }
示例#11
0
                public void ShouldThrowExceptionWhenCountIsZero()
                {
                    IMagickFactory factory = new MagickFactory();

                    ExceptionAssert.Throws <ArgumentException>("count", () =>
                    {
                        factory.CreateImageInfo(new byte[] { 215 }, 0, 0);
                    });
                }
示例#12
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_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);
        }
示例#14
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);
                }
        public void CreateImageInfo_WithBytesAndSettings_ReturnsMagickImageInfo()
        {
            var data = new byte[] { 255 };
            MagickReadSettings readSettings = CreateReadSettings();

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

            Assert.IsInstanceOfType(imageInfo, typeof(MagickImageInfo));
            Assert.AreEqual(1, imageInfo.Width);
        }
        public void CreateImageInfo_WithStream_ReturnsMagickImageInfo()
        {
            using (var stream = File.OpenRead(Files.ImageMagickJPG))
            {
                MagickFactory    factory   = new MagickFactory();
                IMagickImageInfo imageInfo = factory.CreateImageInfo(stream);

                Assert.IsInstanceOfType(imageInfo, typeof(MagickImageInfo));
                Assert.AreEqual(123, imageInfo.Width);
            }
        }
示例#17
0
                public void ShouldCreateMagickImage()
                {
                    IMagickFactory factory = new MagickFactory();

                    using (var stream = File.OpenRead(Files.ImageMagickJPG))
                    {
                        IMagickImageInfo info = factory.CreateImageInfo(stream);

                        Assert.IsInstanceOfType(info, typeof(MagickImageInfo));
                        Assert.AreEqual(123, info.Width);
                    }
                }
        public void CreateImageInfo_WithFileNameAndSettings_ReturnsMagickImageInfo()
        {
            var data         = new byte[] { 255 };
            var readSettings = CreateReadSettings();

            using (TemporaryFile file = new TemporaryFile(data))
            {
                MagickFactory    factory   = new MagickFactory();
                IMagickImageInfo imageInfo = factory.CreateImageInfo(file.FullName, readSettings);

                Assert.IsInstanceOfType(imageInfo, typeof(MagickImageInfo));
                Assert.AreEqual(1, imageInfo.Width);
            }
        }