public void AddsFiveCardsHaveFiveCardsInTheHand()
 {
     var hand = new Hand();
     hand.AddCard(new Card(Rank.Ace, Suit.Clubs));
     hand.AddCard(new Card(Rank.Two, Suit.Clubs));
     hand.AddCard(new Card(Rank.Three, Suit.Clubs));
     hand.AddCard(new Card(Rank.Four, Suit.Clubs));
     hand.AddCard(new Card(Rank.Five, Suit.Clubs));
     Assert.AreEqual(hand.CardsCount, 5);
 }
        public void HaveTwoCardsReturnsTwoCommaSeparatedCardsInAscendingOrderAsString()
        {
            var card1 = new Card(Rank.Three, Suit.Clubs);
            var card2 = new Card(Rank.Two, Suit.Clubs);

            var hand = new Hand();
            hand.AddCard(card1);
            hand.AddCard(card2);
            Assert.AreEqual(hand.ToString(), card2.ToString() + ", " + card1.ToString());
        }
        public void HaveOneCardReturnsCardAsString()
        {
            var card = new Card(Rank.Ace, Suit.Clubs);

            var hand = new Hand();
            hand.AddCard(card);
            Assert.AreEqual(hand.ToString(), card.ToString());
        }
 public void IndexerFailsWhenPassedIndexLargerThanOrEqualCountOfCardsAtHand()
 {
     var hand = new Hand();
     hand.AddCard(new Card(Rank.Ace, Suit.Clubs));
     var card = hand[1];
 }
 public void AddsOneCardHaveOneCardInTheHand()
 {
     var hand = new Hand();
     hand.AddCard(new Card(Rank.Ace, Suit.Clubs));
     Assert.AreEqual(hand.CardsCount, 1);
 }
        public void IndexerReturnsCardsInAscendingOrder()
        {
            var card1 = new Card(Rank.Three, Suit.Clubs);
            var card2 = new Card(Rank.Two, Suit.Clubs);

            var hand = new Hand();
            hand.AddCard(card1);
            hand.AddCard(card2);
            Assert.AreEqual(card2, hand[0]);
        }
 public void IndexerReturnsOnZeroBasedIndex()
 {
     var card = new Card(Rank.Ace, Suit.Clubs);
     var hand = new Hand();
     hand.AddCard(card);
     Assert.AreEqual(card, hand[0]);
 }
 private static Hand CreateHandWithTwoPairs()
 {
     Hand hand = new Hand();
     hand.AddCard(new Card(Rank.Nine, Suit.Clubs));
     hand.AddCard(new Card(Rank.Nine, Suit.Hearts));
     hand.AddCard(new Card(Rank.Ten, Suit.Clubs));
     hand.AddCard(new Card(Rank.Ten, Suit.Hearts));
     hand.AddCard(new Card(Rank.King, Suit.Clubs));
     return hand;
 }
        public void IndexerReturnsCardsByIndex()
        {
            var higherCardAdded = new Card(Rank.King, Suit.Clubs);

            var hand = new Hand();
            hand.AddCard(higherCardAdded);
            hand.AddCard(new Card(Rank.Queen, Suit.Clubs));
            hand.AddCard(new Card(Rank.Jack, Suit.Clubs));
            Assert.AreEqual(higherCardAdded, hand[2]);
        }
 private static Hand CreateHandWithStraightFlush()
 {
     Hand hand = new Hand();
     hand.AddCard(new Card(Rank.Nine, Suit.Clubs));
     hand.AddCard(new Card(Rank.Ten, Suit.Clubs));
     hand.AddCard(new Card(Rank.Jack, Suit.Clubs));
     hand.AddCard(new Card(Rank.Queen, Suit.Clubs));
     hand.AddCard(new Card(Rank.King, Suit.Clubs));
     return hand;
 }
 private static Hand CreateHandWithThreeOfAKind()
 {
     Hand hand = new Hand();
     hand.AddCard(new Card(Rank.Nine, Suit.Clubs));
     hand.AddCard(new Card(Rank.Nine, Suit.Hearts));
     hand.AddCard(new Card(Rank.Nine, Suit.Diamonds));
     hand.AddCard(new Card(Rank.Queen, Suit.Clubs));
     hand.AddCard(new Card(Rank.King, Suit.Clubs));
     return hand;
 }
 private static Hand CreateHandWithOnePair()
 {
     Hand hand = new Hand();
     hand.AddCard(new Card(Rank.Nine, Suit.Clubs));
     hand.AddCard(new Card(Rank.Nine, Suit.Hearts));
     hand.AddCard(new Card(Rank.Jack, Suit.Clubs));
     hand.AddCard(new Card(Rank.Queen, Suit.Clubs));
     hand.AddCard(new Card(Rank.King, Suit.Clubs));
     return hand;
 }
 private static Hand CreateHandWithNoCombination()
 {
     Hand hand = new Hand();
     hand.AddCard(new Card(Rank.Ace, Suit.Clubs));
     hand.AddCard(new Card(Rank.Three, Suit.Hearts));
     hand.AddCard(new Card(Rank.Five, Suit.Diamonds));
     hand.AddCard(new Card(Rank.Seven, Suit.Spades));
     hand.AddCard(new Card(Rank.Nine, Suit.Clubs));
     return hand;
 }
 private static Hand CreateHandWithFullHouse()
 {
     Hand hand = new Hand();
     hand.AddCard(new Card(Rank.Nine, Suit.Clubs));
     hand.AddCard(new Card(Rank.Nine, Suit.Hearts));
     hand.AddCard(new Card(Rank.Ten, Suit.Clubs));
     hand.AddCard(new Card(Rank.Ten, Suit.Hearts));
     hand.AddCard(new Card(Rank.Ten, Suit.Spades));
     return hand;
 }
 private static Hand CreateHandWithFlush()
 {
     Hand hand = new Hand();
     hand.AddCard(new Card(Rank.Ace, Suit.Clubs));
     hand.AddCard(new Card(Rank.Three, Suit.Clubs));
     hand.AddCard(new Card(Rank.Five, Suit.Clubs));
     hand.AddCard(new Card(Rank.Seven, Suit.Clubs));
     hand.AddCard(new Card(Rank.Nine, Suit.Clubs));
     return hand;
 }
 private static Hand CreateHandWithAceHighStraight()
 {
     Hand hand = new Hand();
     hand.AddCard(new Card(Rank.Ten, Suit.Hearts));
     hand.AddCard(new Card(Rank.Jack, Suit.Clubs));
     hand.AddCard(new Card(Rank.Queen, Suit.Clubs));
     hand.AddCard(new Card(Rank.King, Suit.Clubs));
     hand.AddCard(new Card(Rank.Ace, Suit.Clubs));
     return hand;
 }