public void CompareTo_WHERE_other_hand_rank_is_same_reference_SHOULD_return_zero() { //arrange _instance = new PokerHandBasedHandRank(PokerHand.FullHouse); //act var actual = _instance.CompareTo(_instance); //assert Assert.That(actual, Is.EqualTo(0)); }
public void CompareTo_WHERE_other_hand_rank_is_null_SHOULD_return_one() { //arrange _instance = new PokerHandBasedHandRank(PokerHand.FullHouse); //act var actual = _instance.CompareTo(null); //assert Assert.That(actual, Is.EqualTo(1)); }
public void CompareTo_WHERE_other_hand_ranks_poker_hand_is_higher_SHOULD_return_minus_one(PokerHand thisPokerHand, PokerHand otherPokerHand) { //arrange _instance = new PokerHandBasedHandRank(thisPokerHand); var otherHandRank = new PokerHandBasedHandRank(otherPokerHand); //act var actual = _instance.CompareTo(otherHandRank); //assert Assert.That(actual, Is.EqualTo(-1)); }
public void CompareTo_WHERE_other_hand_ranks_poker_hand_is_identical_and_no_kickers_SHOULD_return_zero(PokerHand pokerHand) { //arrange _instance = new PokerHandBasedHandRank(pokerHand); var otherHandRank = new PokerHandBasedHandRank(pokerHand, new List <CardValue>()); //act var actual = _instance.CompareTo(otherHandRank); //assert Assert.That(actual, Is.Zero); }
public void CompareTo_WHERE_other_hand_ranks_poker_hand_is_identical_and_other_hand_rank_is_not_PokerHandBasedHandRank_SHOULD_throw_error(PokerHand pokerHand) { //arrange _instance = new PokerHandBasedHandRank(pokerHand); var otherHandRank = new Mock <IHandRank <PokerHand> >(); otherHandRank.Setup(x => x.Rank).Returns(pokerHand); //act + assert var actualException = Assert.Throws <ArgumentException>(() => _instance.CompareTo(otherHandRank.Object)); Assert.That(actualException.Message, Is.EqualTo("Other HandRank is not PokerHandBasedHandRank")); }
public void CompareTo_WHERE_other_hand_ranks_poker_hand_is_identical_and_has_different_number_of_kickers_to_current_hand_rank_SHOULD_throw_error(PokerHand pokerHand) { //arrange _instance = new PokerHandBasedHandRank(pokerHand, new List <CardValue> { CardValue.Ten, CardValue.Four }); var otherHandRank = new PokerHandBasedHandRank(pokerHand, new List <CardValue> { CardValue.King, CardValue.Three, CardValue.Two }); //act + assert var actualException = Assert.Throws <Exception>(() => _instance.CompareTo(otherHandRank)); Assert.That(actualException.Message, Is.EqualTo("Cannot compare hand ranks, kickers have different lengths")); }
public void CompareTo_WHERE_other_hand_ranks_poker_hand_is_identical_and_kickers_differ_in_fifth_kicker_with_other_hand_ranks_kicker_being_higher_SHOULD_return_minus_one(PokerHand pokerHand) { //arrange _instance = new PokerHandBasedHandRank(pokerHand, new List <CardValue> { CardValue.King, CardValue.Ten, CardValue.Nine, CardValue.Seven, CardValue.Three }); var otherHandRank = new PokerHandBasedHandRank(pokerHand, new List <CardValue> { CardValue.King, CardValue.Ten, CardValue.Nine, CardValue.Seven, CardValue.Five }); //act var actual = _instance.CompareTo(otherHandRank); //assert Assert.That(actual, Is.EqualTo(-1)); }
public void CompareTo_WHERE_other_hand_ranks_poker_hand_is_identical_and_kickers_differ_in_third_kicker_with_other_hand_ranks_kicker_being_lower_SHOULD_return_one(PokerHand pokerHand) { //arrange _instance = new PokerHandBasedHandRank(pokerHand, new List <CardValue> { CardValue.Ten, CardValue.Eight, CardValue.Six }); var otherHandRank = new PokerHandBasedHandRank(pokerHand, new List <CardValue> { CardValue.Ten, CardValue.Eight, CardValue.Four }); //act var actual = _instance.CompareTo(otherHandRank); //assert Assert.That(actual, Is.EqualTo(1)); }