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); }
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); }
public void TestCheckNullOrEmpty() { PlayerCards = ""; var actualResultException = Assert.ThrowsException <Exception>(() => CardDataValidations.EvaluatePokerHands(PlayerCards)); var expectedResult = PokerConstants.InvalidInputMessage; Assert.AreEqual(expectedResult, actualResultException.Message); }
public void TestInvalidLenthInput() { PlayerCards = "2H 3D 5S "; var actualResultException = Assert.ThrowsException <Exception>(() => CardDataValidations.EvaluatePokerHands(PlayerCards)); var expectedResult = PokerConstants.InvalidInputLengthMessage; Assert.AreEqual(expectedResult, actualResultException.Message); }
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); } }