コード例 #1
0
ファイル: Program.cs プロジェクト: Adreynd/Lab-4-and-5
        static void TestingRedBlack()
        {
            Card c1 = new Card('H', 7);
            Card c2 = new Card('S', 3);


            Console.WriteLine("Testing IsRed.");
            Console.WriteLine("Expecting a card of a red suit.");
            if (c1.IsRed())
            {
                Console.WriteLine("Got a red suit.");
            }
            else
            {
                Console.WriteLine("Didn't get a red suit.");
            }

            Console.WriteLine("Testing IsRed on a black card, expecting not a red card.");
            if (!c2.IsRed())
            {
                Console.WriteLine("Didn't get a red suit.");
            }
            else
            {
                Console.WriteLine("Got a red suit.");
            }
            Console.WriteLine();



            Console.WriteLine("Testing IsBlack.");
            Console.WriteLine("Expecting a card of a black suit.");
            if (c2.IsBlack())
            {
                Console.WriteLine("Got a black suit.");
            }
            else
            {
                Console.WriteLine("Didn't get a black suit.");
            }

            Console.WriteLine("Testing IsBlack on a red card, expecting not a black card.");
            if (!c1.IsBlack())
            {
                Console.WriteLine("Didn't get a black suit.");
            }
            else
            {
                Console.WriteLine("Got a black suit.");
            }
            Console.WriteLine();
        }