Example #1
0
        public override string ToString() //overrides the ToString() in ColorLists
        {
            string colorCodeWithColors = "";

            for (int pairNo = 1; pairNo <= ColorMapMinor.Length * ColorMapMajor.Length; pairNo++)
            {
                ColorPair pair = NumberToColor.GetColorFromPairNumber(pairNo);
                colorCodeWithColors += "Pair Number : " + pairNo + "   Colors : " + pair + "\n";
            }

            return(colorCodeWithColors);
        }
        /// <summary>
        /// Test code for the class
        /// </summary>
        /// <param name="args"></param>
        private static void Main(string[] args)
        {
            int       pairNumber = 4;
            ColorPair testPair1  = NumberToColor.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  = NumberToColor.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  = NumberToColor.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 = PairNumber.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 = PairNumber.GetPairNumberFromColor(testPair2);
            Console.WriteLine("[In]Colors: {0}, [Out] PairNumber: {1}\n\n", testPair2, pairNumber);
            Debug.Assert(pairNumber == 6);

            ReferenceManual referenceManual = new ReferenceManual();

            Console.WriteLine(referenceManual.ToString());
        }