public void ShouldThrowExceptionWhenColorDoesNotStartWithHash() { var factory = new MagickColorFactory(); ExceptionAssert.Throws <ArgumentException>("color", () => { factory.Create("FFFFFF"); }); }
public void ShouldThrowExceptionWhenColorHasInvalidLength() { var factory = new MagickColorFactory(); ExceptionAssert.Throws <ArgumentException>("color", () => { factory.Create("#FFFFF"); }); }
public void ShouldThrowExceptionWhenColorIsEmpty() { var factory = new MagickColorFactory(); ExceptionAssert.Throws <ArgumentException>("color", () => { factory.Create(string.Empty); }); }
public void ShouldThrowExceptionWhenColorIsNull() { var factory = new MagickColorFactory(); ExceptionAssert.Throws <ArgumentNullException>("color", () => { factory.Create((string)null); }); }
public void ShouldThrowExceptionWhenColorHasInvalidHexValue() { var factory = new MagickColorFactory(); Assert.Throws <ArgumentException>("color", () => { factory.Create("#FGF"); }); Assert.Throws <ArgumentException>("color", () => { factory.Create("#GGFFFF"); }); Assert.Throws <ArgumentException>("color", () => { factory.Create("#FFFG000000000000"); }); }
private void TestColor(string hexValue, double red, double green, double blue, bool isTransparent, double delta) { var factory = new MagickColorFactory(); var color = factory.Create(hexValue); Assert.AreEqual(red, color.R, delta); Assert.AreEqual(green, color.G, delta); Assert.AreEqual(blue, color.B, delta); if (isTransparent) { ColorAssert.IsTransparent(color.A); } else { ColorAssert.IsNotTransparent(color.A); } }
private void TestColor(string hexValue, double red, double green, double blue, bool isTransparent, double delta) { var factory = new MagickColorFactory(); var color = factory.Create(hexValue); Assert.InRange(color.R, red - delta, red + delta); Assert.InRange(color.G, green - delta, green + delta); Assert.InRange(color.B, blue - delta, blue + delta); if (isTransparent) { ColorAssert.Transparent(color.A); } else { ColorAssert.NotTransparent(color.A); } }