public void PokerHandDetectorShouldDetectCombination(DetectHandTestCase testCase) { var detector = new PokerHandDetector(); var hand = detector.DetectTopPokerHand(CardParser.ParseCards(testCase.Cards).ToHashSet()); Assert.AreEqual( expected: testCase.ExpectedCombinationKind, actual: hand.CardCombination.Kind); var cardCombnation = hand.CardCombination as CardCombination; CollectionAssert.AreEquivalent( expected: CardParser.ParseCards(testCase.ExpectedCombinationCards), actual: cardCombnation.Cards); var expectedKickers = CardParser.ParseCards(testCase.ExpectedKickers).ToList(); var actualKickers = hand.Kickers .OrderByDescending(k => k.Value) .ThenByDescending(k => k.Suit) // added to define ordering in test as it matters .ToList(); CollectionAssert.AreEqual( expected: expectedKickers, actual: actualKickers ); }
private static TestCaseData ToNUnitCase(DetectHandTestCase handTestCase) { string name = "PokerHandDetectorShouldDetect_" + handTestCase.ExpectedCombinationKind.ToString() + (handTestCase.NameSuffix ?? ""); return(new TestCaseData(handTestCase) .SetName(name)); }