Exemplo n.º 1
0
            public void ShouldThrowExceptionWhenColorDoesNotStartWithHash()
            {
                var factory = new MagickColorFactory();

                ExceptionAssert.Throws <ArgumentException>("color", () =>
                {
                    factory.Create("FFFFFF");
                });
            }
Exemplo n.º 2
0
            public void ShouldThrowExceptionWhenColorHasInvalidLength()
            {
                var factory = new MagickColorFactory();

                ExceptionAssert.Throws <ArgumentException>("color", () =>
                {
                    factory.Create("#FFFFF");
                });
            }
Exemplo n.º 3
0
            public void ShouldThrowExceptionWhenColorIsEmpty()
            {
                var factory = new MagickColorFactory();

                ExceptionAssert.Throws <ArgumentException>("color", () =>
                {
                    factory.Create(string.Empty);
                });
            }
Exemplo n.º 4
0
            public void ShouldThrowExceptionWhenColorIsNull()
            {
                var factory = new MagickColorFactory();

                ExceptionAssert.Throws <ArgumentNullException>("color", () =>
                {
                    factory.Create((string)null);
                });
            }
Exemplo n.º 5
0
            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);
                }
            }
Exemplo n.º 6
0
            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);
                }
            }
Exemplo n.º 7
0
            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");
                });
            }