예제 #1
0
    public IEnumerator DeactivatePunishmentCards_TwoActiveCardsOneToDeactivate()
    {
        //Tests that if there is an active card owned by the player, it becomes deactivated when deactivatePunishmentCards is called.
        Setup();
        //Give the player two punishment cards
        Player player1 = players [0];

        Card card1 = new FreshersFluCard(player1);
        Card card2 = new NothingCard(player1);

        player1.AddPunishmentCard(card1);
        player1.AddPunishmentCard(card2);

        //Activate cards
        cardDeck.GetActiveCards().Add(card1);
        cardDeck.GetActiveCards().Add(card2);

        card1.SetTurnCount(2);          //Card will not be deactivated this turn...
        card2.SetTurnCount(1);          //...But this one will.

        cardDeck.DeactivatePunishmentCards(player1);

        //Test that card1 is still active.
        Assert.Contains(card1, cardDeck.GetActiveCards());
        Assert.AreEqual(1, card1.GetTurnCount());
        Assert.AreSame(player1, card1.GetOwner());

        //Test that card2 has been deactivated.
        Assert.IsFalse(cardDeck.GetActiveCards().Contains(card2));
        Assert.Zero(card2.GetTurnCount());
        Assert.IsNull(card2.GetOwner());
        yield return(null);
    }
예제 #2
0
    public IEnumerator DeactivatePunishmentCards_OtherPlayerHasActiveCardNoneToDeactivate()
    {
        //Tests that if deactivatedPunishmentCards is called for a player with no active cards, another player's active card will not be deactivated.
        Setup();
        //Give player1 a punishment cards
        Player player1    = players [0];
        Card   activeCard = new FreshersFluCard(player1);

        player1.AddPunishmentCard(activeCard);

        //Activate card
        cardDeck.GetActiveCards().Add(activeCard);
        activeCard.SetTurnCount(1);

        Player player2 = players [1];

        cardDeck.DeactivatePunishmentCards(player2);          //Call DeactivatePunishmentCards for player2.

        //Test that activeCard is still active.
        Assert.Contains(activeCard, cardDeck.GetActiveCards());
        Assert.AreEqual(1, activeCard.GetTurnCount());
        Assert.AreSame(player1, activeCard.GetOwner());
        yield return(null);
    }