Esempio n. 1
0
        public void DiscardDeckIsEmptied_ReturnsListOfCards()
        {
            // Arrange
            const int NumberOfCards = 5;
            Card      card          = new Card(
                new Hashtable()
            {
                { "display", "A" },
                { "value", 11 },
                { "alternativeValue", 1 },
            },
                new Hashtable()
            {
                { "suit", "Hearts" },
                { "color", "Red" },
            }
                );
            DiscardDeck discardDeck = new DiscardDeck();
            List <Card> emptiedCards;

            // Act
            for (int i = 0; i < NumberOfCards; i++)
            {
                discardDeck.addCard(card);
            }
            emptiedCards = discardDeck.clearDiscardPile();

            // Assert
            Assert.AreEqual(0, discardDeck.getCount());
            Assert.AreEqual(NumberOfCards, emptiedCards.Count);
        }
Esempio n. 2
0
        private void moveCardFromDrawDeckToDiscardDeck()
        {
            int       drawDeckTopCardIndex = drawDeck.topCardIndex();
            BasicCard drawDeckTopCard      = drawDeck.CardDeck[drawDeckTopCardIndex];

            drawDeck.removeCard(drawDeckTopCardIndex, discardDeck);
            discardDeck.addCard(drawDeckTopCard);
        }
Esempio n. 3
0
        public bool playCard(int cardIndex)
        {
            bool      isPlayComplete = false;
            BasicCard cardToBePlayed = hand.CardDeck[cardIndex];

            if (discardDeck.isCardPlayable(cardToBePlayed))
            {
                hand.removeCard(cardIndex);
                discardDeck.addCard(cardToBePlayed);
                cardToBePlayed.playCard();
                isPlayComplete = true;
            }
            else
            {
                Console.WriteLine(cardToBePlayed.lookAtCard() + " is not playable.");
            }

            return(isPlayComplete);
        }
Esempio n. 4
0
        public void AddsToDiscardDeck_ReturnsVoid()
        {
            // Arrange
            Card card = new Card(
                new Hashtable()
            {
                { "display", "A" },
                { "value", 11 },
                { "alternativeValue", 1 },
            },
                new Hashtable()
            {
                { "suit", "Hearts" },
                { "color", "Red" },
            }
                );
            DiscardDeck discardDeck = new DiscardDeck();

            // Act
            discardDeck.addCard(card);

            // Assert
            Assert.AreEqual(1, discardDeck.getCount());
        }