private static TestCaseData ToNUnitCase(CompareHandsTestCase handTestCase) { string name = "InComparisonOfHandsShouldWin" + "_" + (handTestCase.NameSuffix ?? ""); return(new TestCaseData(handTestCase) .SetName(name)); }
public void PokerHandsComparisons(CompareHandsTestCase testCase) { var detector = new PokerHandDetector(); var commonCards = CardParser.ParseCards(testCase.CommonCards); var aliceCards = CardParser.ParseCards(testCase.AliceCards); var bobCards = CardParser.ParseCards(testCase.BobCards); var aliceTopHand = detector.DetectTopPokerHand(aliceCards.Concat(commonCards).ToHashSet()); var bobTopHand = detector.DetectTopPokerHand(bobCards.Concat(commonCards).ToHashSet()); var winner = DetectWinner(aliceTopHand, bobTopHand); Assert.AreEqual(expected: testCase.ExpectedTopHandPlayer, actual: winner); }