public void ColorGTest() { GraphicsRepository <Bitmap, Color> graphics = new GraphicsRepository <Bitmap, Color>(); Color color = Color.Red; Assert.AreEqual(color.G, graphics.ColorG(color)); }
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); }