Ejemplo n.º 1
0
        public bool HasThisHand(PlayerHand hand)
        {
            if (5 > hand.Cards.Count)
            {
                return false;
            }

            ThreeOfAKind threeOfAKind = new ThreeOfAKind();
            OnePair onePair = new OnePair();

            return threeOfAKind.HasThisHand(hand) && onePair.HasThisHand(hand);
        }
Ejemplo n.º 2
0
        public void ThreeOfAKindTest()
        {
            PlayerHand threeOfAKind = new PlayerHand();
            threeOfAKind.AddCard(new Card(Suits.Spades, Faces.Ten));
            threeOfAKind.AddCard(new Card(Suits.Clubs, Faces.Ten));
            threeOfAKind.AddCard(new Card(Suits.Hearts, Faces.Ten));
            threeOfAKind.AddCard(new Card(Suits.Spades, Faces.King));
            threeOfAKind.AddCard(new Card(Suits.Spades, Faces.Ace));

            PlayerHand twoPairs = new PlayerHand();
            twoPairs.AddCard(new Card(Suits.Spades, Faces.Ten));
            twoPairs.AddCard(new Card(Suits.Clubs, Faces.Ten));
            twoPairs.AddCard(new Card(Suits.Hearts, Faces.King));
            twoPairs.AddCard(new Card(Suits.Spades, Faces.King));
            twoPairs.AddCard(new Card(Suits.Spades, Faces.Ace));

            IHand handModel = new ThreeOfAKind();

            Assert.IsTrue(handModel.HasThisHand(threeOfAKind));
            Assert.IsFalse(handModel.HasThisHand(twoPairs));
        }