Ejemplo n.º 1
0
        public void ColorFromArgbTest()
        {
            GraphicsRepository <Bitmap, Color> graphics = new GraphicsRepository <Bitmap, Color>();
            Color color = graphics.ColorFromArgb(0, 1, 2, 3);

            Assert.AreEqual(0, color.A);
            Assert.AreEqual(1, color.R);
            Assert.AreEqual(2, color.G);
            Assert.AreEqual(3, color.B);
        }
Ejemplo n.º 2
0
        public void WrongTypesTest()
        {
            GraphicsRepository <Color, Bitmap> graphics = new GraphicsRepository <Color, Bitmap>();
            bool exceptionThrown = false;

            try
            {
                var bgColor = graphics.GetBackgroundColor();
            }
            catch
            {
                exceptionThrown = true;
            }
            Assert.IsTrue(exceptionThrown);
            exceptionThrown = false;
            try
            {
                var bgColor = graphics.CreateGraphicsObject(10, 10);
            }
            catch
            {
                exceptionThrown = true;
            }
            Assert.IsTrue(exceptionThrown);
            exceptionThrown = false;
            try
            {
                var bgColor = graphics.ColorFromArgb(10, 10, 10, 10);
            }
            catch
            {
                exceptionThrown = true;
            }
            Assert.IsTrue(exceptionThrown);
            exceptionThrown = false;
            try
            {
                var bgColor = graphics.ColorA(new Bitmap(10, 10));
            }
            catch
            {
                exceptionThrown = true;
            }
            Assert.IsTrue(exceptionThrown);
            exceptionThrown = false;
            try
            {
                var bgColor = graphics.ColorB(new Bitmap(10, 10));
            }
            catch
            {
                exceptionThrown = true;
            }
            Assert.IsTrue(exceptionThrown);
            exceptionThrown = false;
            try
            {
                var bgColor = graphics.ColorR(new Bitmap(10, 10));
            }
            catch
            {
                exceptionThrown = true;
            }
            Assert.IsTrue(exceptionThrown);
            exceptionThrown = false;
            try
            {
                var bgColor = graphics.ColorG(new Bitmap(10, 10));
            }
            catch
            {
                exceptionThrown = true;
            }
            Assert.IsTrue(exceptionThrown);
        }