private static void Main(string[] args) { int pairNumber = 4; ColorPair testPair1 = ValueOfColorPair.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 = ValueOfColorPair.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 = ValueOfColorPair.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 = PairNumberEncoder.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 = PairNumberEncoder.GetPairNumberFromColor(testPair2); Console.WriteLine("[In]Colors: {0}, [Out] PairNumber: {1}", testPair2, pairNumber); Debug.Assert(pairNumber == 6); }
public override string ToString() { int totalnumberofcolorpairpossible = Program.returnLengthOfColorMapMinor() * Program.returnLengthOfColorMapMajor(); string str = ""; for (int i = 1; i <= totalnumberofcolorpairpossible; i++) { str = str + string.Format("PairNumber : MajorColor, MinorColor\n", i, ValueOfColorPair.GetColorFromPairNumber(i)); } return(str); }