public void DoWork() { // instantiate the Immutable color class var myColor1 = new Immutable.Color(red: 127, green: 63, blue: 255); Console.WriteLine(myColor1.ToString()); Console.WriteLine(myColor1.IsWhite); var myColor2 = new Immutable.Color(red: 191); Console.WriteLine(myColor2.ToString()); Console.WriteLine(myColor2.IsBlack()); Color color1 = new Color.Builder().Create(); // defaults Color color2 = new Color.Builder().Red(127).Create(); // red only Color color3 = new Color.Builder().Green(63).Alpha(255).Create(); // Green and Alpha var greenValue = color3.Green; Console.WriteLine(greenValue); //color2.Red = 0; Color lightenedColor = color3.Lighten(22); Console.WriteLine(lightenedColor.IsBlack()); Console.ReadLine(); }
public void ReturnFalseWhenRGBNotZero() { var color1 = new ConsoleApp.Immutable.Color(1, 0, 0); var color2 = new ConsoleApp.Immutable.Color(0, 1, 0); var color3 = new ConsoleApp.Immutable.Color(0, 0, 1); Assert.IsFalse(color1.IsBlack()); Assert.IsFalse(color2.IsBlack()); Assert.IsFalse(color3.IsBlack()); }
public void ReturnTrueWhenRGBAreZero() { // Arrange var color = new ConsoleApp.Immutable.Color(0, 0, 0); // Act var isBlack = color.IsBlack(); // Assert Assert.IsTrue(isBlack); }