Exemplo n.º 1
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.º 2
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.º 3
0
 public void BothPlayers_Straight_HighRank_Wins()
 {
     var pokerGame = new PokerGame(PokerHandTestHelper.CreateStraightHighJackHand("John"),
                             PokerHandTestHelper.CreateStraightHighQueenHand("Bob"));
       var result = pokerGame.PlayHand();
       Assert.AreEqual(HandRankResult.Straight, result.RankResult);
       Assert.AreEqual("Bob", result.WinningPlayer);
 }
Exemplo n.º 4
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.º 5
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.º 6
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.º 7
0
 public override long Solve()
 {
     int player1Wins = 0;
       for (int i = 0; i < player1Hands.Count; i++) {
     var winner = new PokerGame(player1Hands[i], player2Hands[i]).PlayHand();
        // Console.WriteLine("Winner of Hand {0}: {1} with {2}", i, winner, "Pair Of Nuts");
     if (winner.WinningPlayer == "Player One") {
       player1Wins++;
     }
       }
       return player1Wins;
 }
Exemplo n.º 8
0
        public override long Solve()
        {
            int player1Wins = 0;

            for (int i = 0; i < player1Hands.Count; i++)
            {
                var winner = new PokerGame(player1Hands[i], player2Hands[i]).PlayHand();
                // Console.WriteLine("Winner of Hand {0}: {1} with {2}", i, winner, "Pair Of Nuts");
                if (winner.WinningPlayer == "Player One")
                {
                    player1Wins++;
                }
            }
            return(player1Wins);
        }
Exemplo n.º 9
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.º 10
0
 public void First_High_Card_Wins()
 {
     var pokerGame = new PokerGame(PokerHandTestHelper.CreateHighCardNineHand("John"),
                            PokerHandTestHelper.CreateHighCardAceHand("Bob"));
       var result = pokerGame.PlayHand();
       Assert.AreEqual(HandRankResult.High_Card, result.RankResult);
       Assert.AreEqual("Bob", 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 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.º 13
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.º 14
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.º 15
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.º 16
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.º 17
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.º 18
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);
 }