public void ShouldNotThrowExceptionWhenSettingsIsNull() { IMagickFactory factory = new MagickFactory(); using (var images = factory.CreateCollection(File.ReadAllBytes(Files.CirclePNG), null)) { } }
public void ShouldThrowExceptionWhenOffsetIsNegative() { IMagickFactory factory = new MagickFactory(); ExceptionAssert.Throws<ArgumentException>("offset", () => { factory.CreateCollection(new byte[] { 215 }, -1, 0); }); }
public void ShouldNotThrowExceptionWhenSettingsIsNull() { IMagickFactory factory = new MagickFactory(); var bytes = File.ReadAllBytes(Files.CirclePNG); using (IMagickImageCollection image = factory.CreateCollection(bytes, 0, bytes.Length, null)) { } }
public void ShouldNotThrowExceptionWhenSettingsIsNull() { IMagickFactory factory = new MagickFactory(); using (IMagickImageCollection images = factory.CreateCollection(Files.CirclePNG, null)) { Assert.IsInstanceOfType(images, typeof(MagickImageCollection)); } }
public void ShouldThrowExceptionWhenArrayIsNull() { IMagickFactory factory = new MagickFactory(); ExceptionAssert.Throws<ArgumentNullException>("data", () => { factory.CreateCollection((byte[])null); }); }
public void ShouldThrowExceptionWhenStreamIsNull() { IMagickFactory factory = new MagickFactory(); ExceptionAssert.Throws<ArgumentNullException>("stream", () => { factory.CreateCollection((Stream)null); }); }
public void ShouldThrowExceptionWhenArrayIsEmpty() { IMagickFactory factory = new MagickFactory(); ExceptionAssert.Throws<ArgumentException>("data", () => { factory.CreateCollection(new byte[] { }); }); }
public void ShouldThrowExceptionWhenCountIsZero() { IMagickFactory factory = new MagickFactory(); ExceptionAssert.Throws<ArgumentException>("count", () => { factory.CreateCollection(new byte[] { 215 }, 0, 0); }); }
public void ShouldThrowExceptionWhenStreamIsEmpty() { IMagickFactory factory = new MagickFactory(); ExceptionAssert.Throws<ArgumentException>("stream", () => { factory.CreateCollection(new MemoryStream()); }); }
public void ShouldThrowExceptionWhenFileNameIsEmpty() { IMagickFactory factory = new MagickFactory(); ExceptionAssert.Throws<ArgumentException>("fileName", () => { factory.CreateCollection(string.Empty); }); }
public void ShouldThrowExceptionWhenFileInfoIsNull() { IMagickFactory factory = new MagickFactory(); ExceptionAssert.Throws<ArgumentNullException>("fileName", () => { factory.CreateCollection((string)null); }); }
public void ShouldCreateMagickImage() { IMagickFactory factory = new MagickFactory(); using (IMagickImageCollection images = factory.CreateCollection(Files.ImageMagickJPG)) { Assert.IsInstanceOfType(images, typeof(MagickImageCollection)); } }
public void ShouldThrowExceptionWhenFileNameIsNull() { IMagickFactory factory = new MagickFactory(); var settings = new MagickReadSettings(); ExceptionAssert.Throws<ArgumentNullException>("fileName", () => { factory.CreateCollection((string)null, settings); }); }
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 ShouldCreateMagickImageCollection() { IMagickFactory factory = new MagickFactory(); var data = File.ReadAllBytes(Files.ImageMagickJPG); using (IMagickImageCollection images = factory.CreateCollection(data)) { Assert.IsInstanceOfType(images, typeof(MagickImageCollection)); } }
public void CreateCollection_WithFileName_ReturnsMagickImageCollection() { MagickFactory factory = new MagickFactory(); using (IMagickImageCollection collection = factory.CreateCollection(Files.RoseSparkleGIF)) { Assert.IsInstanceOfType(collection, typeof(MagickImageCollection)); Assert.AreEqual(3, collection.Count); } }
public void ShouldThrowExceptionWhenArrayIsNull() { IMagickFactory factory = new MagickFactory(); var settings = new MagickReadSettings(); ExceptionAssert.Throws<ArgumentNullException>("data", () => { factory.CreateCollection(null, 0, 0, settings); }); }
public void ShouldThrowExceptionWhenCountIsNegative() { IMagickFactory factory = new MagickFactory(); var settings = new MagickReadSettings(); ExceptionAssert.Throws<ArgumentException>("count", () => { using (IMagickImageCollection images = factory.CreateCollection(new byte[] { 215 }, 0, -1, settings)) { } }); }
public void CreateCollection_WithBytes_ReturnsMagickImageCollection() { var data = File.ReadAllBytes(Files.RoseSparkleGIF); MagickFactory factory = new MagickFactory(); using (IMagickImageCollection collection = factory.CreateCollection(data)) { Assert.IsInstanceOfType(collection, typeof(MagickImageCollection)); Assert.AreEqual(3, collection.Count); } }
public void ShouldReadImage() { IMagickFactory factory = new MagickFactory(); var fileBytes = File.ReadAllBytes(Files.SnakewarePNG); var bytes = new byte[fileBytes.Length + 10]; fileBytes.CopyTo(bytes, 10); using (IMagickImageCollection images = factory.CreateCollection(bytes, 10, bytes.Length - 10)) { Assert.AreEqual(1, images.Count); } }
public void ShouldCreateMagickImageCollection() { IMagickFactory factory = new MagickFactory(); var data = File.ReadAllBytes(Files.ImageMagickJPG); var readSettings = new MagickReadSettings { BackgroundColor = MagickColors.Goldenrod, }; using (IMagickImageCollection image = factory.CreateCollection(data, readSettings)) { Assert.IsInstanceOfType(image, typeof(MagickImageCollection)); } }
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); } }
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); }); }