Пример #1
0
        public void TestHasDuplicateCards()
        {
            PlayerCards = "2H 3D 5S 9C 9C 2C 3Z 4S 8C AH";
            var actualResultException = Assert.ThrowsException <Exception>(() => CardDataValidations.EvaluatePokerHands(PlayerCards));
            var expectedResult        = PokerConstants.InvalidInputDuplicatesMessage;

            Assert.AreEqual(expectedResult, actualResultException.Message);
        }
Пример #2
0
        public void TestInvalidCardRank()
        {
            PlayerCards = "1H 3D 1S 9C KH 2C 3S 1D 8C AH";
            var actualResultException = Assert.ThrowsException <Exception>(() => CardDataValidations.EvaluatePokerHands(PlayerCards));
            var expectedResult        = PokerConstants.InvalidInputRanksMessage;

            Assert.AreEqual(expectedResult, actualResultException.Message);
        }
Пример #3
0
        public void TestCheckNullOrEmpty()
        {
            PlayerCards = "";
            var actualResultException = Assert.ThrowsException <Exception>(() => CardDataValidations.EvaluatePokerHands(PlayerCards));
            var expectedResult        = PokerConstants.InvalidInputMessage;

            Assert.AreEqual(expectedResult, actualResultException.Message);
        }
Пример #4
0
        public void TestInvalidLenthInput()
        {
            PlayerCards = "2H 3D 5S ";
            var actualResultException = Assert.ThrowsException <Exception>(() => CardDataValidations.EvaluatePokerHands(PlayerCards));
            var expectedResult        = PokerConstants.InvalidInputLengthMessage;

            Assert.AreEqual(expectedResult, actualResultException.Message);
        }
Пример #5
0
 private static void LetsPlay()
 {
     try
     {
         Console.WriteLine("Enter the cards from the players' hands: \n");
         string hands  = Console.ReadLine().ToUpper();
         string winner = CardDataValidations.EvaluatePokerHands(hands);
         Console.WriteLine(winner);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }