public void OnePairTest()
        {
            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));

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

            IHand handModel = new OnePair();

            Assert.IsTrue(handModel.HasThisHand(onePair));
            Assert.IsFalse(handModel.HasThisHand(threeOfAKind));
            Assert.IsFalse(handModel.HasThisHand(twoPairs));
        }
Beispiel #2
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);
        }