Beispiel #1
0
        public void TestRankHand()
        {
            // Test an example of each of the 9 ranks we expcect for this game
            // Noting that rank 0 is not possible in this game (because the Joker is dead! R.I.P Heath Ledger!
            //structure of this test case is...
            // create a collection of hands w/ expected rannk
            // loop through collection, cal RankHand() and compare actual vs expected
            // fail the test when the first expected is NOT equal to the actual result

            IPokerRules         pr        = new FiveCardDrawPokerRules();
            List <RankTestHand> testCases = CreateRankTestHands();

            foreach (RankTestHand h in testCases)
            {
                Assert.AreEqual(h.rank, pr.RankHand(h.hand));
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            // Two Simple Demos for Assignment 2
            Random rand = new Random();

            // 1. Deal one hand, print the rank and names of the hand.
            FiveCardDrawPokerRules pr   = new FiveCardDrawPokerRules();
            AceHighPokerDeck       deck = new AceHighPokerDeck(rand);

            deck.Shuffle();
            IHand h1 = pr.DealHand(deck);

            Console.WriteLine("Demo 1...");
            Console.WriteLine("Rank = " + pr.RankHand(h1));
            //Console.WriteLine("Name = " + pr.NameHand(h1));
            // 2. Deal two hands print the rank and names of the hands, compare and print who wins.
        }