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