public void PlayShouldCallGetTurnAndEndTurnForBothPlayers() { var firstPlayer = new ValidPlayer(); var firstPlayerInfo = new RoundPlayerInfo(firstPlayer); var secondPlayer = new ValidPlayer(); var secondPlayerInfo = new RoundPlayerInfo(secondPlayer); var stateManager = new StateManager(); var deck = new Deck(); SimulateGame(firstPlayerInfo, secondPlayerInfo, deck); var trick = new Trick(firstPlayerInfo, secondPlayerInfo, stateManager, deck, GameRulesProvider.Santase); var winner = trick.Play(); Assert.AreEqual(1, firstPlayer.GetTurnCalledCount); Assert.AreEqual(1, secondPlayer.GetTurnCalledCount); Assert.AreEqual(1, firstPlayer.EndTurnCalledCount); Assert.AreEqual(1, secondPlayer.EndTurnCalledCount); Assert.IsNotNull(firstPlayer.GetTurnContextObject); Assert.IsNotNull(secondPlayer.GetTurnContextObject); Assert.IsNotNull(firstPlayer.EndTurnContextObject); Assert.IsNotNull(secondPlayer.EndTurnContextObject); Assert.IsNotNull(firstPlayer.EndTurnContextObject.FirstPlayedCard); Assert.IsNotNull(firstPlayer.EndTurnContextObject.SecondPlayedCard); Assert.IsNotNull(secondPlayer.EndTurnContextObject.FirstPlayedCard); Assert.IsNotNull(secondPlayer.EndTurnContextObject.SecondPlayedCard); Assert.IsTrue(winner == firstPlayerInfo || winner == secondPlayerInfo); }
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()); }
public void ChangingTrumpCardShouldNotThrow() { Deck deck = new Deck(); Card trumpCard = deck.GetTrumpCard; Card newCard = new Card(CardSuit.Heart, CardType.Nine); deck.ChangeTrumpCard(newCard); }
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"); }
public void TestDeckChangeTrumpCard() { var card = new Card(CardSuit.Club, CardType.Jack); var deck = new Santase.Logic.Cards.Deck(); deck.ChangeTrumpCard(card); Assert.AreEqual(card, deck.GetTrumpCard); }
public void ExpectTrumpCardToBeCorrectAfterAChange() { var deck = new Deck(); var trumpCard = deck.GetNextCard(); deck.ChangeTrumpCard(trumpCard); Assert.AreSame(deck.GetTrumpCard, trumpCard); }
public void ExpectTrumpCardToEqualSwappedCard() { var deck = new Deck(); var card = new Card(CardSuit.Club, CardType.Ace); deck.ChangeTrumpCard(card); Assert.AreEqual(card, deck.GetTrumpCard); }
public void TestDeckGetNextCard() { var deck = new Santase.Logic.Cards.Deck(); var card = deck.GetNextCard(); Assert.AreEqual(23, deck.CardsLeft); }
public void DeckTestGetNextCard25TimesShouldThrow() { var deck = new Deck(); for (int i = 0; i < cardsCount + 1; i++) { var card = deck.GetNextCard(); } }
public void GetNextCardShouldNotChangeTheTrumpCard() { IDeck deck = new Deck(); var trumpBefore = deck.TrumpCard; deck.GetNextCard(); var trumpAfter = deck.TrumpCard; Assert.AreEqual(trumpBefore, trumpAfter); }
public void ChangeTrumpCardShouldWorkProperly() { IDeck deck = new Deck(); var card = new Card(CardSuit.Spade, CardType.Nine); deck.ChangeTrumpCard(card); var trumpCard = deck.TrumpCard; Assert.AreEqual(card, trumpCard); }
public void DeckShouldThrowAnExceptionWhenDrawingMoreCardsThanInTheDeck() { var deck = new Deck(); for (int i = 1; i <= 25; i++) { deck.GetNextCard(); } }
public void TestNextCardGotFromTheDeckIsNotNull() { Deck gameDeck = new Deck(); int initialCardsCount = gameDeck.CardsLeft; Assert.Greater(initialCardsCount, 0); Card nextCard = gameDeck.GetNextCard(); Assert.IsNotNull(nextCard); }
public void ChangeTrumpCardShouldChangeTheTrumpCardIfThereAreCardsLeftInTheDeck() { Deck testDeck = new Deck(); Card initialTrumpCard = testDeck.GetTrumpCard; Card newCard = testDeck.GetNextCard(); testDeck.ChangeTrumpCard(newCard); Assert.AreNotSame(initialTrumpCard, testDeck.GetTrumpCard); }
public void TestChangeWtihDifferentTrumps(string patternForCard) { Deck cards = new Deck(); Card trump = GenerateCard(patternForCard); cards.ChangeTrumpCard(trump); Assert.AreEqual(trump.Type.ToFriendlyString() + trump.Suit.ToFriendlyString(), cards.GetTrumpCard.ToString()); }
public void TestDeckGetNextCardWhenDeckIsEmpty(int count) { var deck = new Santase.Logic.Cards.Deck(); for (int i = 0; i < count; i++) { var card = deck.GetNextCard(); } }
public void GetNextCardShouldThrowExceptionIfGetNextCardIsCalledMoreThanTheNumberOfCardsInDeck() { var deck = new Deck(); for (int i = 0; i <= CardsCount; i++) { deck.GetNextCard(); } }
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"); }
public void GetNextCardThrowsAfterTakeCardFromEmptyDeck(int count) { var deck = new Deck(); for (int i = 0; i < count; i++) { deck.GetNextCard(); } }
public void ExpectGetNextCardToThrowWhenDrawingMoreThanTheDeckSize() { var deck = new Deck(); for (int i = 0; i < 25; i++) { var card = deck.GetNextCard(); } }
public void GetNextCardShouldThrowAnInternalGameExceptionWhenThereAreNoCardsLeftInTheDeck(int cardsToBeDrawn) { Deck testDeck = new Deck(); for (int i = 0; i < cardsToBeDrawn; i++) { testDeck.GetNextCard(); } }
public void DeckShouldReturnProperTrumpCardAfterChangingIt() { var deck = new Deck(); var newTrumpCard = new Card(CardSuit.Heart, CardType.Ace); deck.ChangeTrumpCard(newTrumpCard); var currentTrumpCard = deck.GetTrumpCard; Assert.AreSame(newTrumpCard, currentTrumpCard); }
public void DeckShouldThrowWhenNextCardIsNotPresent() { Deck deck = new Deck(); for (int i = 0; i < InitialDeckCardsCount + 1; i++) { deck.GetNextCard(); } }
public void DrawNextCardOnEmptyDeck_ShouldThrowException() { var deck = new Deck(); for (int card = 0; card <= DeckSize; card++) { deck.GetNextCard(); } }
public void ChangeTrumpCardChangesItSuccessfully() { var deck = new Deck(); var trumpCard = deck.GetTrumpCard; deck.ChangeTrumpCard(new Card(CardSuit.Club, CardType.Ace)); var changedTrumpCard = deck.GetTrumpCard; Assert.AreNotEqual(trumpCard, changedTrumpCard, "Trump cards are the same! Rerun test if by chance the original trump card was the same as the new one!"); }
public void CreatingNewDeckAndChangingDefaultTrumpCardWithTheSameTrumpCardShouldReturnTheSameTrumpCard() { var deck = new Deck(); var trumpCard = deck.GetTrumpCard; deck.ChangeTrumpCard(trumpCard); Assert.AreSame(trumpCard, deck.GetTrumpCard); }
public void DrawNextCardFromEmptyDeckShouldThrowException(int cardsToBeDrawn) { var deck = new Deck(); for (int i = 0; i < cardsToBeDrawn; i++) { deck.GetNextCard(); } Assert.Throws<InternalGameException>(() => deck.GetNextCard()); }
public void ThrowExceptionOnGettingNextCartOnEmptyDeck() { Deck deck = new Deck(); for (int i = 0; i <= 24; i++) { deck.GetNextCard(); } }
public void CreatingNewDeckAndGettingMoreThan24NextCardsShouldThrowAnException(int countOfCards) { var deck = new Deck(); for (int i = 0; i < countOfCards; i++) { var nextCard = deck.GetNextCard(); } }
public void DeckShouldChangeTrumpCardCorrectly() { Deck deck = new Deck(); Card newTrumpCard = new Card(CardSuit.Spade, CardType.Ace); deck.ChangeTrumpCard(newTrumpCard); Assert.AreEqual(newTrumpCard, deck.GetTrumpCard); }
public void DrawNextCardOnEmptyDeckShouldThrow() { var deck = new Deck(); for (int card = 0; card <= 24; card++) { deck.GetNextCard(); } }
public void TestDeckCtorWithInvalidCardsCount(int cardsCount) { var deck = new Santase.Logic.Cards.Deck(); if (cardsCount == 24) { Assert.AreEqual(cardsCount, deck.CardsLeft); } else { Assert.AreNotEqual(cardsCount, deck.CardsLeft); } }