Пример #1
0
 protected override void ShowCards()
 {
     _hand = new Poker(_cards);
     lbPokerHand.Items.Clear();
     foreach (Card cardName in _cards)
     {
         lbPokerHand.Items.Add(cardName.ToString());
     }
     int sumOfHand = _hand.GetSumOfCards();
     lblHand.Text = "You have a " + _hand.GetHandType(sumOfHand);
 }
Пример #2
0
        public void IsFlush()
        {
            List<Card> hand = new List<Card>()
                                  {
                                      new Card(Rank.Three, Suit.Clubs),
                                      new Card(Rank.Two, Suit.Clubs),
                                      new Card(Rank.Ace, Suit.Clubs),
                                      new Card(Rank.Four, Suit.Clubs),
                                      new Card(Rank.Five, Suit.Clubs)
                                  };
            Poker pokerHand = new Poker(hand);

            Assert.AreEqual(true, pokerHand.IsFlush());
        }
Пример #3
0
        public void GetHandType()
        {
            List<Card> hand = new List<Card>()
                                  {
                                      new Card(Rank.Ten, Suit.Spades),
                                      new Card(Rank.Ten, Suit.Diamonds),
                                      new Card(Rank.Ten, Suit.Clubs),
                                      new Card(Rank.Ten, Suit.Hearts),
                                      new Card(Rank.Six, Suit.Clubs)
                                  };
            Poker pokerHand = new Poker(hand);
            int getHandSum = pokerHand.GetSumOfCards();

            Assert.AreEqual(TypeOfHand.FourOfAKind, pokerHand.GetHandType(getHandSum));
        }
Пример #4
0
        public void GetHandSum()
        {
            List<Card> hand = new List<Card>()
                                  {
                                      new Card(Rank.Ace, Suit.Spades),
                                      new Card(Rank.Ace, Suit.Clubs),
                                      new Card(Rank.Ace, Suit.Hearts),
                                      new Card(Rank.Five, Suit.Diamonds),
                                      new Card(Rank.Five, Suit.Clubs)
                                  };
            Poker pokerHand = new Poker(hand);
            int getHandSum = pokerHand.GetSumOfCards();

            Assert.AreEqual(30, getHandSum);
        }
Пример #5
0
        public void IsRoyalFlush()
        {
            List<Card> hand = new List<Card>()
                                  {
                                      new Card(Rank.Ten, Suit.Clubs),
                                      new Card(Rank.King, Suit.Clubs),
                                      new Card(Rank.Ace, Suit.Clubs),
                                      new Card(Rank.Jack, Suit.Clubs),
                                      new Card(Rank.Queen, Suit.Clubs)
                                  };
            Poker pokerHand = new Poker(hand);

            Assert.AreEqual(true, pokerHand.IsRoyalFlush());
        }
Пример #6
0
        public void StraightHand()
        {
            List<Card> hand = new List<Card>()
                                  {
                                      new Card(Rank.Three, Suit.Clubs),
                                      new Card(Rank.Two, Suit.Hearts),
                                      new Card(Rank.Ace, Suit.Spades),
                                      new Card(Rank.Four, Suit.Diamonds),
                                      new Card(Rank.Five, Suit.Spades)
                                  };
            Poker pokerHand = new Poker(hand);

            Assert.AreEqual(true, pokerHand.IsStraight());
        }