Ejemplo n.º 1
0
        public void AcceptPlayersHand_ReturnsHighestScore(string playersHand, string expectedScore)
        {
            var hand   = new PlayerHand();
            var result = hand.GetScore(playersHand);

            Assert.Equal(expectedScore, result);
        }
Ejemplo n.º 2
0
        public string CaluclateResult(string player1Cards, string player2Cards)
        {
            var playerOneHand = new PlayerHand(player1Cards);
            var playerTwoHand = new PlayerHand(player2Cards);

            if (playerTwoHand.GetScore().Value == playerOneHand.GetScore().Value)
            {
                if (playerTwoHand.HighCard().Rank > playerOneHand.HighCard().Rank)
                {
                    return($"Player2 wins - {playerTwoHand.GetScore().Description}");
                }

                if (playerOneHand.HighCard().Rank > playerTwoHand.HighCard().Rank)
                {
                    return($"Player1 wins - {playerOneHand.GetScore().Description}");
                }
                return("Draw");
            }
            if (playerTwoHand.GetScore().Value > playerOneHand.GetScore().Value)
            {
                return($"Player2 wins - {playerTwoHand.GetScore().Description}");
            }
            return($"Player1 wins - {playerOneHand.GetScore().Description}");
        }