Esempio n. 1
0
        public void DealCards()
        {
            var numberOfCardsPerPlayer = _gameController.PlayersToCardCount[_gameController.PlayerCount]; // How many cards should we give each player? Depends on number of players in the game

            _deck = new StandardPlayingCardDeck();                                                        // Create a new deck and shuffle.
            _deck.Shuffle();

            // Deal the right number of cards to each player
            foreach (var player in _gameController.Players)
            {
                var playerHand = _deck.Draw(numberOfCardsPerPlayer);
                player.CardHandController.SetCardsInHand(playerHand);
            }
        }
Esempio n. 2
0
        public void StandardPlayingCardDeck_BasicInitializationTest()
        {
            // Arrange.
            const bool expectedFaceUp   = true;
            const bool expectedFaceDown = false;
            StandardPlayingCardDeck defaultDeck;
            StandardPlayingCardDeck faceUpDeck;
            StandardPlayingCardDeck faceDownDeck;

            // Act.
            defaultDeck  = new StandardPlayingCardDeck();
            faceUpDeck   = new StandardPlayingCardDeck(expectedFaceUp);
            faceDownDeck = new StandardPlayingCardDeck(expectedFaceDown);

            // Assert.
            Assert.AreEqual(expectedFaceDown, defaultDeck.IsFaceUp);
            Assert.AreEqual(expectedFaceUp, faceUpDeck.IsFaceUp);
            Assert.AreEqual(expectedFaceDown, faceDownDeck.IsFaceUp);
            foreach (var deck in new StandardPlayingCardDeck[] { defaultDeck, faceUpDeck, faceDownDeck })
            {
                Assert.IsFalse(deck.IsEmpty);
                Assert.AreEqual(52, deck.Cards.Count);
            }
        }