public void Four_of_a_kind_beats_a_full_house() { var actual = Poker.BestHands(new[] { "4S 5H 4D 5D 4H", "3S 3H 2S 3D 3C" }); var expected = new[] { "3S 3H 2S 3D 3C" }; Assert.Equal(expected, actual); }
public void Double_pair_vs_three() { const string doublePair2And8 = "2S 8H 2S 8D JH"; const string threeOf4 = "4S 5H 4S 8D 4H"; Assert.That(Poker.BestHands(new[] { doublePair2And8, threeOf4 }), Is.EqualTo(new[] { threeOf4 })); }
public void Three_vs_straight() { const string threeOf4 = "4S 5H 4S 8D 4H"; const string straight = "3S 4H 2S 6D 5H"; Assert.That(Poker.BestHands(new[] { threeOf4, straight }), Is.EqualTo(new[] { straight })); }
public void Square_vs_straight_flush() { const string squareOf5 = "4S 5H 5S 5D 5H"; const string straightFlushTo9 = "5S 7S 8S 9S 6S"; Assert.That(Poker.BestHands(new[] { squareOf5, straightFlushTo9 }), Is.EqualTo(new[] { straightFlushTo9 })); }
public void One_pair_vs_double_pair() { const string pairOf8 = "2S 8H 6S 8D JH"; const string doublePair = "4S 5H 4S 8D 5H"; Assert.That(Poker.BestHands(new[] { pairOf8, doublePair }), Is.EqualTo(new[] { doublePair })); }
public void Two_fulls() { const string fullOf4By9 = "4H 4S 4D 9S 9D"; const string fullOf5By8 = "5H 5S 5D 8S 8D"; Assert.That(Poker.BestHands(new[] { fullOf4By9, fullOf5By8 }), Is.EqualTo(new[] { fullOf5By8 })); }
public void Nothing_vs_one_pair() { const string nothing = "4S 5H 6S 8D JH"; const string pairOf4 = "2S 4H 6S 4D JH"; Assert.That(Poker.BestHands(new[] { nothing, pairOf4 }), Is.EqualTo(new[] { pairOf4 })); }
public void Multiple_hands_with_the_same_high_cards_tie_compares_next_highest_ranked_down_to_last_card() { var actual = Poker.BestHands(new[] { "3S 5H 6S 8D 7H", "2S 5D 6D 8C 7S" }); var expected = new[] { "3S 5H 6S 8D 7H" }; Assert.Equal(expected, actual); }
public void One_pair_beats_high_card() { var actual = Poker.BestHands(new[] { "4S 5H 6C 8D KH", "2S 4H 6S 4D JH" }); var expected = new[] { "2S 4H 6S 4D JH" }; Assert.Equal(expected, actual); }
public void A_tie_has_multiple_winners() { var actual = Poker.BestHands(new[] { "4D 5S 6S 8D 3C", "2S 4C 7S 9H 10H", "3S 4S 5D 6H JH", "3H 4H 5C 6C JD" }); var expected = new[] { "3S 4S 5D 6H JH", "3H 4H 5C 6C JD" }; Assert.Equal(expected, actual); }
public void Both_hands_have_straight_flush_tie_goes_to_highest_ranked_card() { var actual = Poker.BestHands(new[] { "4H 6H 7H 8H 5H", "5S 7S 8S 9S 6S" }); var expected = new[] { "5S 7S 8S 9S 6S" }; Assert.Equal(expected, actual); }
public void Straight_flush_beats_four_of_a_kind() { var actual = Poker.BestHands(new[] { "4S 5H 5S 5D 5C", "7S 8S 9S 6S 10S" }); var expected = new[] { "7S 8S 9S 6S 10S" }; Assert.Equal(expected, actual); }
public void With_multiple_decks_both_hands_with_identical_four_of_a_kind_tie_determined_by_kicker() { var actual = Poker.BestHands(new[] { "3S 3H 2S 3D 3C", "3S 3H 4S 3D 3C" }); var expected = new[] { "3S 3H 4S 3D 3C" }; Assert.Equal(expected, actual); }
public void Both_hands_have_four_of_a_kind_tie_goes_to_high_quad() { var actual = Poker.BestHands(new[] { "2S 2H 2C 8D 2D", "4S 5H 5S 5D 5C" }); var expected = new[] { "4S 5H 5S 5D 5C" }; Assert.Equal(expected, actual); }
public void Two_flushes() { const string flushTo8 = "3H 6H 7H 8H 5H"; const string flushTo7 = "2S 4S 5S 6S 7S"; Assert.That(Poker.BestHands(new[] { flushTo8, flushTo7 }), Is.EqualTo(new[] { flushTo8 })); }
public void Highest_pair_wins() { var actual = Poker.BestHands(new[] { "4S 2H 6S 2D JH", "2S 4H 6C 4D JD" }); var expected = new[] { "2S 4H 6C 4D JD" }; Assert.Equal(expected, actual); }
public void Flush_vs_full() { const string flushTo8 = "3H 6H 7H 8H 5H"; const string full = "4S 5H 4S 5D 4H"; Assert.That(Poker.BestHands(new[] { full, flushTo8 }), Is.EqualTo(new[] { full })); }
public void Two_pairs_beats_one_pair() { var actual = Poker.BestHands(new[] { "2S 8H 6S 8D JH", "4S 5H 4C 8C 5C" }); var expected = new[] { "4S 5H 4C 8C 5C" }; Assert.Equal(expected, actual); }
public void Full_vs_square() { const string full = "4S 5H 4S 5D 4H"; const string squareOf3 = "3S 3H 2S 3D 3H"; Assert.That(Poker.BestHands(new[] { full, squareOf3 }), Is.EqualTo(new[] { squareOf3 })); }
public void Single_hand_always_wins() { var actual = Poker.BestHands(new[] { "4S 5S 7H 8D JC" }); var expected = new[] { "4S 5S 7H 8D JC" }; Assert.Equal(expected, actual); }
public void Two_squares() { const string squareOf2 = "2S 2H 2S 8D 2H"; const string squareOf5 = "4S 5H 5S 5D 5H"; Assert.That(Poker.BestHands(new[] { squareOf2, squareOf5 }), Is.EqualTo(new[] { squareOf5 })); }
public void Both_hands_have_two_pairs_highest_ranked_pair_wins() { var actual = Poker.BestHands(new[] { "2S 8H 2D 8D 3H", "4S 5H 4C 8S 5D" }); var expected = new[] { "2S 8H 2D 8D 3H" }; Assert.Equal(expected, actual); }
public void Two_pairs() { const string pairOf2 = "4S 2H 6S 2D JH"; const string pairOf4 = "2S 4H 6S 4D JH"; Assert.That(Poker.BestHands(new[] { pairOf2, pairOf4 }), Is.EqualTo(new[] { pairOf4 })); }
public void Both_hands_have_two_pairs_with_the_same_highest_ranked_pair_tie_goes_to_low_pair() { var actual = Poker.BestHands(new[] { "2S QS 2C QD JH", "JD QH JS 8D QC" }); var expected = new[] { "JD QH JS 8D QC" }; Assert.Equal(expected, actual); }
public void Two_double_pairs() { const string doublePair2And8 = "2S 8H 2S 8D JH"; const string doublePair4And5 = "4S 5H 4S 8D 5H"; Assert.That(Poker.BestHands(new[] { doublePair2And8, doublePair4And5 }), Is.EqualTo(new[] { doublePair2And8 })); }
public void Both_hands_have_two_identically_ranked_pairs_tie_goes_to_remaining_card_kicker_() { var actual = Poker.BestHands(new[] { "JD QH JS 8D QC", "JS QS JC 2D QD" }); var expected = new[] { "JD QH JS 8D QC" }; Assert.Equal(expected, actual); }
public void Two_threes() { const string threeOf2 = "2S 2H 2S 8D JH"; const string threeOf1 = "4S AH AS 8D AH"; Assert.That(Poker.BestHands(new[] { threeOf2, threeOf1 }), Is.EqualTo(new[] { threeOf1 })); }
public void Three_of_a_kind_beats_two_pair() { var actual = Poker.BestHands(new[] { "2S 8H 2H 8D JH", "4S 5H 4C 8S 4H" }); var expected = new[] { "4S 5H 4C 8S 4H" }; Assert.Equal(expected, actual); }
public void Straight_vs_flush() { const string straightTo8 = "4S 6H 7S 8D 5H"; const string flushTo7 = "2S 4S 5S 6S 7S"; Assert.That(Poker.BestHands(new[] { straightTo8, flushTo7 }), Is.EqualTo(new[] { flushTo7 })); }
public void With_multiple_decks_both_hands_have_a_full_house_with_the_same_triplet_tie_goes_to_the_pair() { var actual = Poker.BestHands(new[] { "5H 5S 5D 9S 9D", "5H 5S 5D 8S 8D" }); var expected = new[] { "5H 5S 5D 9S 9D" }; Assert.Equal(expected, actual); }