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); }
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()); }
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)); }
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); }
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()); }
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()); }