Пример #1
0
 public void DrawNextCardFromEmptyDeckShouldThrowException(int cardsToBeDrawn)
 {
     var deck = new Deck();
     for (int i = 0; i < cardsToBeDrawn; i++)
     {
         deck.GetNextCard();
     }
     Assert.Throws<InternalGameException>(() => deck.GetNextCard());
 }
Пример #2
0
 public void DeckTestGetNextCard24TimesShouldReturn24ValidCards()
 {
     var deck = new Deck();
     for (int i = 0; i < cardsCount; i++)
     {
         var card = deck.GetNextCard();
         Assert.IsTrue(Enum.IsDefined(typeof(CardSuit), deck.GetNextCard().Suit), "Invalid card suit: " + deck.GetTrumpCard.Suit.ToString() + "in position " + (i + 1));
         Assert.IsTrue(Enum.IsDefined(typeof(CardType), deck.GetNextCard().Type), "Invalid card type: " + deck.GetTrumpCard.Type.ToString() + "in position " + (i + 1));
     }
 }
 public void TestGetNextCardFromEmptyDeckThrowsException()
 {
     var deck = new Deck();
     int cardsCount = deck.CardsLeft;
     Card card = deck.GetNextCard();
     for (int i = 1; i <= cardsCount; i++)
     {
         card = deck.GetNextCard();
     }
 }
Пример #4
0
 public void TestGettingCardsFromDeckShouldProperlyUpdateTheCountOfCardsLeft(int countOfCardsToGet)
 {
     var deck = new Deck();
     var card = deck.GetNextCard();
     int cardsLeftCount = deck.CardsLeft;
     for (int i = 1; i < countOfCardsToGet; i++)
     {
         card = deck.GetNextCard();
         cardsLeftCount--;
     }
     Assert.AreEqual(deck.CardsLeft, cardsLeftCount);
 }
Пример #5
0
        public void ExpectTheTrumpCardToBeTakenLast()
        {
            var deck = new Deck();
            var trumpCard = deck.GetTrumpCard;
            Card lastCard = deck.GetNextCard();

            while (deck.CardsLeft > 0)
            {
                lastCard = deck.GetNextCard();
            }

            Assert.AreSame(trumpCard, lastCard);
        }
Пример #6
0
 public void TestChangeTrumpCardShouldProperlyUpdateBothTrumpCardAndDeckTopCard(CardSuit suit, CardType type)
 {
     Deck deck = new Deck();
     Card newTrumpCard = new Card(suit, type);
     deck.ChangeTrumpCard(newTrumpCard);
     int cardsCount = deck.CardsLeft;
     Card topCard = deck.GetNextCard();
     for (int i = 1; i < cardsCount; i++)
     {
         topCard = deck.GetNextCard();
     }
     Assert.AreEqual(topCard, newTrumpCard);
 }
Пример #7
0
        public void ChangeTrumpCardShouldChangeTheLastCardInTheDeck()
        {
            IDeck deck = new Deck();
            var card = new Card(CardSuit.Club, CardType.Ace);
            deck.ChangeTrumpCard(card);
            var cardsCount = deck.CardsLeft;
            for (var i = 0; i < cardsCount - 1; i++)
            {
                deck.GetNextCard();
            }

            var lastCard = deck.GetNextCard();
            Assert.AreEqual(card, lastCard);
        }
Пример #8
0
        public void CreatingNewDeckAndGetting23NextCardsAndThenChangingTrumpCardShouldReturnNextCardTheSameAsTrumpCard()
        {
            var deck = new Deck();

            for (int i = 0; i < 23; i++)
            {
                var nextCard = deck.GetNextCard();
            }

            deck.ChangeTrumpCard(new Card(CardSuit.Spade, CardType.Ace));
            var lastCard = deck.GetNextCard();

            Assert.AreSame(lastCard, deck.GetTrumpCard);
        }
Пример #9
0
 public void TestsIfCardRemovalWorks()
 {
     Deck testDeck = new Deck();
     int initialCardsCount = testDeck.CardsLeft;
     testDeck.GetNextCard();
     Assert.AreEqual((initialCardsCount - 1), testDeck.CardsLeft, "GetNextCard() should remove 1 card from the deck");
 }
Пример #10
0
 public void DeckTestGetNextCardShouldReturnValidCard()
 {
     var deck = new Deck();
     var card = deck.GetNextCard();
     Assert.IsTrue(Enum.IsDefined(typeof(CardSuit), card.Suit), "Invalid card suit: " + deck.GetTrumpCard.Suit.ToString());
     Assert.IsTrue(Enum.IsDefined(typeof(CardType), card.Type), "Invalid card type: " + deck.GetTrumpCard.Type.ToString());
 }
Пример #11
0
 public void ExpectTrumpCardToBeCorrectAfterAChange()
 {
     var deck = new Deck();
     var trumpCard = deck.GetNextCard();
     deck.ChangeTrumpCard(trumpCard);
     Assert.AreSame(deck.GetTrumpCard, trumpCard);
 }
Пример #12
0
        public void TestDeckGetNextCard()
        {
            var deck = new Santase.Logic.Cards.Deck();
            var card = deck.GetNextCard();

            Assert.AreEqual(23, deck.CardsLeft);
        }
Пример #13
0
 public void DeckTestGetNextCard25TimesShouldThrow()
 {
     var deck = new Deck();
     for (int i = 0; i < cardsCount + 1; i++)
     {
         var card = deck.GetNextCard();
     }
 }
Пример #14
0
 public void GetNextCardShouldNotChangeTheTrumpCard()
 {
     IDeck deck = new Deck();
     var trumpBefore = deck.TrumpCard;
     deck.GetNextCard();
     var trumpAfter = deck.TrumpCard;
     Assert.AreEqual(trumpBefore, trumpAfter);
 }
Пример #15
0
 public void DeckShouldThrowAnExceptionWhenDrawingMoreCardsThanInTheDeck()
 {
     var deck = new Deck();
     for (int i = 1; i <= 25; i++)
     {
         deck.GetNextCard();
     }
 }
Пример #16
0
 public void TestNextCardGotFromTheDeckIsNotNull()
 {
     Deck gameDeck = new Deck();
     int initialCardsCount = gameDeck.CardsLeft;
     Assert.Greater(initialCardsCount, 0);
     Card nextCard = gameDeck.GetNextCard();
     Assert.IsNotNull(nextCard);
 }
 public void TestDeckGetNextCardWhenDeckIsEmpty(int count)
 {
     var deck = new Santase.Logic.Cards.Deck();
     for (int i = 0; i < count; i++)
     {
         var card = deck.GetNextCard();
     }
 }
Пример #18
0
 public void ExpectGetNextCardToThrowWhenDrawingMoreThanTheDeckSize()
 {
     var deck = new Deck();
     for (int i = 0; i < 25; i++)
     {
         var card = deck.GetNextCard();
     }
 }
Пример #19
0
 public void GetNextCardShouldThrowExceptionIfGetNextCardIsCalledMoreThanTheNumberOfCardsInDeck()
 {
     var deck = new Deck();
     for (int i = 0; i <= CardsCount; i++)
     {
         deck.GetNextCard();
     }
 }
Пример #20
0
 public void GetNextCardThrowsAfterTakeCardFromEmptyDeck(int count)
 {
     var deck = new Deck();
     for (int i = 0; i < count; i++)
     {
         deck.GetNextCard();
     }
 }
Пример #21
0
 public void GetNextCardShouldThrowAnInternalGameExceptionWhenThereAreNoCardsLeftInTheDeck(int cardsToBeDrawn)
 {
     Deck testDeck = new Deck();
     for (int i = 0; i < cardsToBeDrawn; i++)
     {
         testDeck.GetNextCard();
     }
 }
Пример #22
0
 public void ChangeTrumpCardShouldChangeTheTrumpCardIfThereAreCardsLeftInTheDeck()
 {
     Deck testDeck = new Deck();
     Card initialTrumpCard = testDeck.GetTrumpCard;
     Card newCard = testDeck.GetNextCard();
     testDeck.ChangeTrumpCard(newCard);
     Assert.AreNotSame(initialTrumpCard, testDeck.GetTrumpCard);
 }
Пример #23
0
        public void TestGetNextCardShouldRemoveTheCardFromTheDeck()
        {
            Deck deck = new Deck();
            int initialNumberOfCards = deck.CardsLeft;
            deck.GetNextCard();

            Assert.AreEqual((initialNumberOfCards - 1), deck.CardsLeft, "GetNextCard() should remove 1 card from the deck");
        }
Пример #24
0
        public void DeckShouldThrowWhenGetCardAndDeckIsEmpty()
        {
            var deck = new Deck();

            for (int i = 0; i <= 25; i++)
            {
                deck.GetNextCard();
            }
        }
Пример #25
0
        public void TestDeckGetNextCardWhenDeckIsEmpty(int count)
        {
            var deck = new Santase.Logic.Cards.Deck();

            for (int i = 0; i < count; i++)
            {
                var card = deck.GetNextCard();
            }
        }
Пример #26
0
        public void DeckCreationTest()
        {
            var deck = new Deck();

            var card = deck.GetNextCard();

            Assert.AreNotEqual("", card.Suit, "Card suit problem on deck creation");
            Assert.AreNotEqual("", card.Type, "Card type problem on deck creation");
        }
Пример #27
0
        public void DeckShouldThrowWhenNextCardIsNotPresent()
        {
            Deck deck = new Deck();

            for (int i = 0; i < InitialDeckCardsCount + 1; i++)
            {
                deck.GetNextCard();
            }
        }
Пример #28
0
        public void DrawNextCardOnEmptyDeck_ShouldThrowException()
        {
            var deck = new Deck();

            for (int card = 0; card <= DeckSize; card++)
            {
                deck.GetNextCard();
            }
        }
Пример #29
0
        public void ThrowExceptionOnGettingNextCartOnEmptyDeck()
        {
            Deck deck = new Deck();

            for (int i = 0; i <= 24; i++)
            {
                deck.GetNextCard();
            }
        }
Пример #30
0
        public void TestChangeTrumpCardToProperlyUpdateTheDeck(CardType type, CardSuit suit)
        {
            Card newCard = new Card(suit, type);
             Deck deck = new Deck();
             int deckLength = deck.CardsLeft;
             deck.ChangeTrumpCard(newCard);
             Card finalCard = new Card(CardSuit.Heart, CardType.Jack);
             for (var i = 0; i < deckLength - 1; i++)
             {
                 deck.GetNextCard();
                 if (i == deckLength - 2)
                 {
                     finalCard = deck.GetNextCard();
                 }
             }

             Assert.AreEqual(finalCard, newCard);
        }
Пример #31
0
        public void DrawNextCardOnEmptyDeckShouldThrow()
        {
            var deck = new Deck();

            for (int card = 0; card <= 24; card++)
            {
                deck.GetNextCard();
            }
        }
        public void TestGetNextCardIfDeckIsEmptyThrowsInternalGameException()
        {
            Deck deck = new Deck();

            for (int i = 0; i <= DeckCardsCount; i++)
            {
                Card card = deck.GetNextCard();
            }
        }