Exemplo n.º 1
0
        public void FourOfAKind()
        {
            var hand = PokerHandTestHelper.CreateFourOfAKindHand("Kevin");

            Assert.IsTrue(hand.IsFourOfAKind());
            Assert.AreEqual(CardRank.Five, hand.RankHighCard);
        }
Exemplo n.º 2
0
        public void OnePair()
        {
            var hand = PokerHandTestHelper.CreateOnePairHand("WOOOOO");

            Assert.IsTrue(hand.IsOnePair());
            Assert.IsFalse(hand.IsTwoPairs());
        }
Exemplo n.º 3
0
        public void IsRoyalFlush()
        {
            var hand = PokerHandTestHelper.CreateRoyalFlushHand("Timmay");

            Assert.IsTrue(hand.IsRoyalFlush());
            Assert.AreEqual(CardRank.Ace, hand.RankHighCard);
        }
Exemplo n.º 4
0
        public void Flush()
        {
            var hand = PokerHandTestHelper.CreateFlushHand("Ren");

            Assert.IsTrue(hand.IsFlush());
            Assert.IsFalse(hand.IsRoyalFlush());
            Assert.AreEqual(CardRank.King, hand.RankHighCard);
        }
Exemplo n.º 5
0
        public void TwoPairs()
        {
            var hand = PokerHandTestHelper.CreateTwoPairsHand("Thing");

            Assert.IsTrue(hand.IsTwoPairs());
            Assert.IsFalse(hand.IsThreeOfAKind());
            Assert.IsFalse(hand.IsOnePair());
        }
Exemplo n.º 6
0
        public void Straight()
        {
            var hand = PokerHandTestHelper.CreateStraightHand("Stimpy");

            Assert.IsTrue(hand.IsStraight());
            Assert.IsFalse(hand.IsStraightFlush());
            Assert.AreEqual(CardRank.Nine, hand.RankHighCard);
        }
Exemplo n.º 7
0
        public void ThreeOfAKind()
        {
            var hand = PokerHandTestHelper.CreateThreeOfAKindHand("Lily");

            Assert.IsTrue(hand.IsThreeOfAKind());
            Assert.IsFalse(hand.IsTwoPairs());
            Assert.IsFalse(hand.IsFullHouse());
            Assert.AreEqual(CardRank.Three, hand.RankHighCard);
        }
Exemplo n.º 8
0
        public void BothPlayers_Flush_HighRank_Wins()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateFlushHighJackHand("John"),
                                          PokerHandTestHelper.CreateFlushHighQueenHand("Bob"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual(HandRankResult.Flush, result.RankResult);
            Assert.AreEqual("Bob", result.WinningPlayer);
        }
Exemplo n.º 9
0
        public void BothPlayers_One_Pair_HighRank_Wins()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateOnePairTensHand("John"),
                                          PokerHandTestHelper.CreateOnePairAcesHand("Bob"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual(HandRankResult.One_Pair, result.RankResult);
            Assert.AreEqual("Bob", result.WinningPlayer);
        }
Exemplo n.º 10
0
        public void BothPlayers_Three_Of_A_Kind_HighRank_Wins()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateThreeOfAKindSevensHand("John"),
                                          PokerHandTestHelper.CreateThreeOfAKindFoursHand("Bob"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual(HandRankResult.Three_Of_A_Kind, result.RankResult);
            Assert.AreEqual("John", result.WinningPlayer);
        }
Exemplo n.º 11
0
        public void FullHouse_Beats_Flush()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateFlushHand("John"),
                                          PokerHandTestHelper.CreateFullHouseHand("Bob"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual(HandRankResult.Full_House, result.RankResult);
            Assert.AreEqual("Bob", result.WinningPlayer);
        }
Exemplo n.º 12
0
        public void BothPlayers_Full_House_HighRank_Wins()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateFullHouse3Fives2NinesHand("John"),
                                          PokerHandTestHelper.CreateFullHouse3Jacks2FoursHand("Bob"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual(HandRankResult.Full_House, result.RankResult);
            Assert.AreEqual("Bob", result.WinningPlayer);
        }
Exemplo n.º 13
0
        public void FourOfAKind_Beats_Full_House()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateFourOfAKindHand("John"),
                                          PokerHandTestHelper.CreateFullHouseHand("Bob"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual(HandRankResult.Four_Of_A_Kind, result.RankResult);
            Assert.AreEqual("John", result.WinningPlayer);
        }
Exemplo n.º 14
0
        public void BothPlayers_Four_Of_A_Kind_HighRank_Wins()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateFourOfAKindFivesHand("John"),
                                          PokerHandTestHelper.FourOfAKindJacksHand("Bob"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual(HandRankResult.Four_Of_A_Kind, result.RankResult);
            Assert.AreEqual("Bob", result.WinningPlayer);
        }
Exemplo n.º 15
0
        public void StraightFlush_beats_FourOfAKind()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateStraightFlushHand("Player1"),
                                          PokerHandTestHelper.CreateFourOfAKindHand("Player2"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual("Player1", result.WinningPlayer);
            Assert.AreEqual(HandRankResult.Straight_Flush, result.RankResult);
        }
Exemplo n.º 16
0
        public void BothPlayers_Straight_Flush_HighRank_Wins()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateStraightFlushHandHighRank10("Player1"),
                                          PokerHandTestHelper.CreateStraightFlushHandHighRankJack("Player2"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual("Player2", result.WinningPlayer);
            Assert.AreEqual(HandRankResult.Straight_Flush, result.RankResult);
        }
Exemplo n.º 17
0
        public void FullHouse()
        {
            var hand = PokerHandTestHelper.CreateFullHouseHand("Lurch");

            Assert.IsFalse(hand.IsFourOfAKind());
            Assert.IsTrue(hand.IsFullHouse());
            Assert.IsFalse(hand.IsThreeOfAKind());
            Assert.AreEqual(CardRank.Jack, hand.RankHighCard);
        }
Exemplo n.º 18
0
        public void Straight_Beats_Three_Of_A_Kind()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateStraightHand("John"),
                                          PokerHandTestHelper.CreateThreeOfAKindHand("Bob"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual(HandRankResult.Straight, result.RankResult);
            Assert.AreEqual("John", result.WinningPlayer);
        }
Exemplo n.º 19
0
        public void BothPlayers_Two_Pairs_HighRank_Wins()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateTwoPairsFivesSevensHand("John"),
                                          PokerHandTestHelper.CreateTwoPairsSixesJacksHand("Bob"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual(HandRankResult.Two_Pairs, result.RankResult);
            Assert.AreEqual("Bob", result.WinningPlayer);
        }
Exemplo n.º 20
0
        public void OnePair_Beats_HighCard()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateHighCardNineHand("John"),
                                          PokerHandTestHelper.CreateOnePairHand("Bob"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual(HandRankResult.One_Pair, result.RankResult);
            Assert.AreEqual("Bob", result.WinningPlayer);
        }
Exemplo n.º 21
0
        public void Two_Pairs_Beats_One_Pair()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateTwoPairsHand("John"),
                                          PokerHandTestHelper.CreateOnePairHand("Bob"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual(HandRankResult.Two_Pairs, result.RankResult);
            Assert.AreEqual("John", result.WinningPlayer);
        }
Exemplo n.º 22
0
        public void Three_Of_A_Kind_Beats_Two_Pairs()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateTwoPairsHand("John"),
                                          PokerHandTestHelper.CreateThreeOfAKindHand("Bob"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual(HandRankResult.Three_Of_A_Kind, result.RankResult);
            Assert.AreEqual("Bob", result.WinningPlayer);
        }
Exemplo n.º 23
0
        public void Flush_Beats_Straight()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateStraightHand("John"),
                                          PokerHandTestHelper.CreateFlushHand("Bob"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual(HandRankResult.Flush, result.RankResult);
            Assert.AreEqual("Bob", result.WinningPlayer);
        }
Exemplo n.º 24
0
        public void Second_High_Card_Wins()
        {
            var pokerGame = new PokerGame(PokerHandTestHelper.CreateHighCardNineSixHand("Bob"),
                                          PokerHandTestHelper.CreateHighCardNineEightHand("John"));
            var result = pokerGame.PlayHand();

            Assert.AreEqual(HandRankResult.High_Card, result.RankResult);
            Assert.AreEqual("John", result.WinningPlayer);
        }
Exemplo n.º 25
0
        public void IsRoyalFlush_Fails()
        {
            var hand = PokerHandTestHelper.CreateOnePairHand("Fester");

            Assert.IsFalse(hand.IsRoyalFlush());
        }
Exemplo n.º 26
0
        public void SecondHighCard()
        {
            var hand = PokerHandTestHelper.CreateOnePairHand("Itt");

            Assert.AreEqual(CardRank.Jack, hand.HandHighCard(2));
        }
Exemplo n.º 27
0
        public void HighCard()
        {
            var hand = PokerHandTestHelper.CreateOnePairHand("Itt");

            Assert.AreEqual(CardRank.King, hand.HandHighCard(1));
        }