示例#1
0
 public void It_should_identify_two_pairs()
 {
     var hand = new PokerHand(twoPairs);
     Assert.IsTrue(hand.IsTwoPairs);
 }
示例#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));
 }
示例#3
0
 public void It_should_identify_pair()
 {
     PokerHand hand = new PokerHand(pair1);
     Assert.IsTrue(hand.IsPair);
     Assert.IsFalse(hand.IsThreeOfaKind);
 }
示例#4
0
 public void It_should_identify_three_of_a_kind()
 {
     var pokerHand = new PokerHand(threeOfaKind);
     Assert.IsTrue(pokerHand.IsThreeOfaKind);
     Assert.IsFalse(pokerHand.IsPair);
 }
示例#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));
        }
示例#6
0
 public void It_should_identify_full_house()
 {
     var hand = new PokerHand(fullHouse);
     Assert.IsTrue(hand.IsFullHouse);
 }
示例#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));
 }
示例#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));
 }
示例#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));
 }
示例#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));
 }
示例#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;
 }