コード例 #1
0
 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);
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 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)
     });
 }
コード例 #4
0
 public ScoreCalculator(PokerHand hand)
 {
     _hand = hand;
 }
コード例 #5
0
 public PokerTable(string cardData)
 {
     _pokerHandFactory = new PokerHandFactory();
     _pokerHand = _pokerHandFactory.BuildHand(cardData);
     _calculator = new ScoreCalculator(_pokerHand);
 }