Example #1
0
 public void AddCard(PokerCard card)
 {
     if (!AlreadyInHand(card))
     {
         Cards.Add(card);
     }
     else
     {
         throw new InvalidPokerHandException("Error: Poker hand does not allow duplicate cards.");
     }
 }
Example #2
0
 private bool AlreadyInHand(PokerCard pokerCard)
 {
     return Cards.Any(card => card.Equals(pokerCard));
 }
 public void Test_3D_Equals_3D()
 {
     var threeD = new PokerCard {CardFace = new Face(Card.Face.Three), CardSuit = new Suit(Card.Suit.Diamonds)};
     var threeOfDiamonds = new PokerCard { CardFace = new Face(Card.Face.Three), CardSuit = new Suit(Card.Suit.Diamonds) };
     Assert.IsTrue(threeD.Equals(threeOfDiamonds));
 }
 public void Test_Ace_Spades_Returns_AD()
 {
     var aceD = new PokerCard { CardFace = new Face(Card.Face.Ace, "A"), CardSuit = new Suit(Card.Suit.Diamonds, "D") };
     Assert.AreEqual("AD", aceD.ToString());
 }
 public void Test_3D_Does_Not_Equal_4D()
 {
     var threeD = new PokerCard { CardFace = new Face(Card.Face.Three), CardSuit = new Suit(Card.Suit.Diamonds) };
     var fourD = new PokerCard { CardFace = new Face(Card.Face.Four), CardSuit = new Suit(Card.Suit.Diamonds) };
     Assert.IsFalse(threeD.Equals(fourD));
 }