public void Test_Add_Card_Increments_Number_Of_Cards() { var hand = new PokerHand(); Assert.IsTrue(hand.Cards.Count == 0); hand.AddCard(new PokerCard {CardFace = new Face(Card.Face.Ace), CardSuit = new Suit(Card.Suit.Hearts) }); Assert.IsTrue(hand.Cards.Count == 1); }
public PokerHand BuildHand(string rawCardCodes) { var cardCodes = ConvertCardCodes(rawCardCodes); HandValidator.ValidateForPokerHand(cardCodes); var hand = new PokerHand(); foreach (var cardCode in cardCodes) { var card = _cardFactory.BuildCard(cardCode); hand.AddCard(card); } return hand; }
public void Test_Add_Card_Duplicate_Throws_Exception() { var hand = new PokerHand(); hand.AddCard(new PokerCard { CardFace = new Face(Card.Face.Ace), CardSuit = new Suit(Card.Suit.Hearts) }); Assert.IsTrue(hand.Cards.Count == 1); hand.AddCard(new PokerCard { CardFace = new Face(Card.Face.Ace), CardSuit = new Suit(Card.Suit.Hearts) }); }
public ScoreCalculator(PokerHand hand) { _hand = hand; }
public PokerTable(string cardData) { _pokerHandFactory = new PokerHandFactory(); _pokerHand = _pokerHandFactory.BuildHand(cardData); _calculator = new ScoreCalculator(_pokerHand); }