public override string ToString() { string majorminorcolorwithpairnumber = ""; int majorcolorlength = colorMapMajor.Length; int minorcolorlength = colorMapMinor.Length; for (int pairNumber = 1; pairNumber <= majorcolorlength * minorcolorlength; pairNumber++) { ColorPair majorminorcolorpair = GetColor.GetColorFromPairNumber(pairNumber); Console.WriteLine("Pair Number: , Colors: \n", pairNumber, majorminorcolorpair); majorminorcolorwithpairnumber += "Pair Number : " + pairNumber + " Colors : " + majorminorcolorpair + "\n"; } return(majorminorcolorwithpairnumber); }
private static void Main(string[] args) { ColorManual testcolormanual = new ColorManual(); Console.WriteLine(testcolormanual.ToString()); int pairNumber = 4; ColorPair testPair1 = GetColor.GetColorFromPairNumber(pairNumber); Console.WriteLine("[In]Pair Number: {0},[Out] Colors: {1}\n", pairNumber, testPair1); Debug.Assert(testPair1.majorColor == Color.White); Debug.Assert(testPair1.minorColor == Color.Brown); pairNumber = 5; testPair1 = GetColor.GetColorFromPairNumber(pairNumber); Console.WriteLine("[In]Pair Number: {0},[Out] Colors: {1}\n", pairNumber, testPair1); Debug.Assert(testPair1.majorColor == Color.White); Debug.Assert(testPair1.minorColor == Color.SlateGray); pairNumber = 23; testPair1 = GetColor.GetColorFromPairNumber(pairNumber); Console.WriteLine("[In]Pair Number: {0},[Out] Colors: {1}\n", pairNumber, testPair1); Debug.Assert(testPair1.majorColor == Color.Violet); Debug.Assert(testPair1.minorColor == Color.Green); ColorPair testPair2 = new ColorPair() { majorColor = Color.Yellow, minorColor = Color.Green }; pairNumber = GetPairNumber.GetPairNumberFromColor(testPair2); Console.WriteLine("[In]Colors: {0}, [Out] PairNumber: {1}\n", testPair2, pairNumber); Debug.Assert(pairNumber == 18); testPair2 = new ColorPair() { majorColor = Color.Red, minorColor = Color.Blue }; pairNumber = GetPairNumber.GetPairNumberFromColor(testPair2); Console.WriteLine("[In]Colors: {0}, [Out] PairNumber: {1}", testPair2, pairNumber); Debug.Assert(pairNumber == 6); }