Example #1
0
        public void FindFourOfAKind()
        {
            CardHand hand = CardHand.FromCards(
                new Card(CardSuits.Spades, CardRanks.Two),
                new Card(CardSuits.Clubs, CardRanks.Ace),
                new Card(CardSuits.Diamonds, CardRanks.Ace),
                new Card(CardSuits.Spades, CardRanks.Ace),
                new Card(CardSuits.Hearts, CardRanks.Ace));

            HandEvaluator evaluator = new HandEvaluator();

            BestHand bestHand = evaluator.FindBestHand(hand);

            Assert.AreEqual(VideoPokerHands.FourOfAKind, bestHand.HandType);
        }
Example #2
0
        public void FindRoyalFlush()
        {
            CardHand hand = CardHand.FromCards(
                new Card(CardSuits.Spades, CardRanks.Ace),
                new Card(CardSuits.Spades, CardRanks.King),
                new Card(CardSuits.Spades, CardRanks.Queen),
                new Card(CardSuits.Spades, CardRanks.Jack),
                new Card(CardSuits.Spades, CardRanks.Ten));

            HandEvaluator evaluator = new HandEvaluator();

            BestHand bestHand = evaluator.FindBestHand(hand);

            Assert.AreEqual(VideoPokerHands.RoyalFlush, bestHand.HandType);
        }
Example #3
0
        public void FindPairJacksOrBetter()
        {
            CardHand hand = CardHand.FromCards(
                new Card(CardSuits.Spades, CardRanks.Two),
                new Card(CardSuits.Spades, CardRanks.Three),
                new Card(CardSuits.Spades, CardRanks.Four),
                new Card(CardSuits.Spades, CardRanks.Ace),
                new Card(CardSuits.Hearts, CardRanks.Ace));

            HandEvaluator evaluator = new HandEvaluator();

            BestHand bestHand = evaluator.FindBestHand(hand);

            Assert.AreEqual(VideoPokerHands.JacksOrBetter, bestHand.HandType);
        }
Example #4
0
        public void FindStraightFlush()
        {
            CardHand hand = CardHand.FromCards(
                new Card(CardSuits.Spades, CardRanks.Two),
                new Card(CardSuits.Spades, CardRanks.Three),
                new Card(CardSuits.Spades, CardRanks.Four),
                new Card(CardSuits.Spades, CardRanks.Five),
                new Card(CardSuits.Spades, CardRanks.Six));

            HandEvaluator evaluator = new HandEvaluator();

            BestHand bestHand = evaluator.FindBestHand(hand);

            Assert.AreEqual(VideoPokerHands.StraightFlush, bestHand.HandType);
        }