Exemplo n.º 1
0
        public void CanAddFiveNonNullCardsToHand()
        {
            var card1 = new Card(new Ace(), new Diamond());
            var card2 = new Card(new Ace(), new Diamond());
            var card3 = new Card(new Ace(), new Diamond());
            var card4 = new Card(new Ace(), new Diamond());
            var card5 = new Card(new Ace(), new Diamond());

            var hand = new FiveCardStudHand();

            hand.Add(card1);
            hand.Add(card2);
            hand.Add(card3);
            hand.Add(card4);
            hand.Add(null);

            Action a = () => hand.Add(card5);

            a.ShouldNotThrow <HandIsFullException>();
        }
Exemplo n.º 2
0
        public void ThrowsHandIsFullExceptionIfAttemptIsMadeToAddMoreThanFiveCardsToHand()
        {
            var card1 = new Card(new Ace(), new Diamond());
            var card2 = new Card(new Ace(), new Diamond());
            var card3 = new Card(new Ace(), new Diamond());
            var card4 = new Card(new Ace(), new Diamond());
            var card5 = new Card(new Ace(), new Diamond());
            var card6 = new Card(new Ace(), new Diamond());

            var hand = new FiveCardStudHand();

            hand.Add(card1);
            hand.Add(card2);
            hand.Add(card3);
            hand.Add(card4);
            hand.Add(card5);

            Action a = () => hand.Add(card6);

            a.ShouldThrow <HandIsFullException>();
        }