Example #1
0
 public void It_should_identify_two_pairs()
 {
     var hand = new PokerHand(twoPairs);
     Assert.IsTrue(hand.IsTwoPairs);
 }
Example #2
0
 public void It_should_say_flush_is_better_than_straight()
 {
     var straightHand = new PokerHand(straight);
     var flushHand = new PokerHand(flush);
     Assert.IsTrue(flushHand.BetterThan(straightHand));
     Assert.IsFalse(straightHand.BetterThan(flushHand));
 }
Example #3
0
 public void It_should_identify_pair()
 {
     PokerHand hand = new PokerHand(pair1);
     Assert.IsTrue(hand.IsPair);
     Assert.IsFalse(hand.IsThreeOfaKind);
 }
Example #4
0
 public void It_should_identify_three_of_a_kind()
 {
     var pokerHand = new PokerHand(threeOfaKind);
     Assert.IsTrue(pokerHand.IsThreeOfaKind);
     Assert.IsFalse(pokerHand.IsPair);
 }
Example #5
0
        public void It_should_say_threeofakind_is_better_than_pair()
        {
            PokerHand pair = new PokerHand(this.pair1);
            var three = new PokerHand(threeOfaKind);

            Assert.IsTrue(three.BetterThan(pair));
            Assert.IsFalse(pair.BetterThan(three));
        }
Example #6
0
 public void It_should_identify_full_house()
 {
     var hand = new PokerHand(fullHouse);
     Assert.IsTrue(hand.IsFullHouse);
 }
Example #7
0
 public void It_should_say_straight_is_better_than_threeofakind()
 {
     var three = new PokerHand(threeOfaKind);
     var straightHand = new PokerHand(straight);
     Assert.IsTrue(straightHand.BetterThan(three));
     Assert.IsFalse(three.BetterThan(straightHand));
 }
Example #8
0
 public void It_should_say_straight_flush_is_better_than_foure_of_a_kind()
 {
     var fourOfaKindHand = new PokerHand(fourOfaKind);
     var straightFlushHand = new PokerHand(straightFlush);
     Assert.IsTrue(straightFlushHand.BetterThan(fourOfaKindHand));
     Assert.IsFalse(fourOfaKindHand.BetterThan(straightFlushHand));
 }
Example #9
0
 public void It_should_say_full_house_is_better_than_flush()
 {
     var flushHand = new PokerHand(flush);
     var fullHouseHand = new PokerHand(fullHouse);
     Assert.IsTrue(fullHouseHand.BetterThan(flushHand));
     Assert.IsFalse(flushHand.BetterThan(fullHouseHand));
 }
Example #10
0
 public void It_should_say_four_of_a_kind_is_better_than_full_house()
 {
     var fullHouseHand = new PokerHand(fullHouse);
     var fourOfaKindHand = new PokerHand(fourOfaKind);
     Assert.IsTrue(fourOfaKindHand.BetterThan(fullHouseHand));
     Assert.IsFalse(fullHouseHand.BetterThan(fourOfaKindHand));
 }
Example #11
0
 public bool BetterThan(PokerHand otherHand)
 {
     var betterRank = otherHand.IsFourOfAKind && IsStraightFlush
                      || otherHand.IsFullHouse && IsFourOfAKind
                      || otherHand.IsFlush && IsFullHouse
                      || otherHand.IsStraight && IsFlush
                      || otherHand.IsThreeOfaKind && IsStraight
                      || otherHand.IsPair && IsThreeOfaKind;
     return betterRank;
 }