示例#1
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.
        }
示例#2
0
        public void TestCompareHand()
        {
            // DealHand should return a pokerHand Instance with the first 5 cards from the deck;
            IPokerRules pr = new FiveCardDrawPokerRules();
            IHand       h  = pr.DealHand(new TestDeck());

            Assert.AreEqual(h.Count, 5); // 5 because it;s 5-card draw!
            Assert.IsInstanceOfType(h, typeof(PokerHand));
            int i = 2;

            foreach (ICard c in h)
            {
                Assert.AreEqual(c.Suit, CardSuit.Club);
                Assert.AreEqual(c.Face, i);
                i++;
            }
            Assert.AreEqual(i, 7); // The last card shoild be a 6
        }