Beispiel #1
0
        public void DrawHands_draws_seven_cards_for_two_players()
        {
            // Arrange.
            var sut = new Deck();

            // Act.
            var hands = sut.DrawHands(2);

            // Assert.
            Assert.That(hands.All(h => h.Count == 7), Is.True);
        }
Beispiel #2
0
        public void DrawHands_draws_five_cards_for_more_than_two_players(int numHands)
        {
            // Arrange.
            var sut = new Deck();

            // Act.
            var hands = sut.DrawHands(numHands);

            // Assert.
            Assert.That(hands.All(h => h.Count == 5), Is.True);
        }
Beispiel #3
0
        public void DrawHands_draws_the_top_cards_from_the_stack()
        {
            // Arrange.
            var seed = Environment.TickCount;
            var sut = new Deck();
            var controlDeck = new Deck();
            sut.Shuffle(seed);
            controlDeck.Shuffle(seed);

            // Act.
            var hands = sut.DrawHands(2);
            var controlHands = hands.Select(hand => hand.Select(card => controlDeck.Draw())).ToList();

            // Assert.
            for (int i = 0; i < hands.Count; i++)
            {
                var hand = hands[i];
                var controlHand = controlHands[i];
                ActualValueDelegate<bool> test = () => hand.SequenceEqual(controlHand);
                Assert.That(test, Is.True);
            }
        }