This commit is contained in:
BetaSteward 2012-02-19 23:13:08 -05:00
parent 828662f6f3
commit 1951fd314b
6 changed files with 431 additions and 1 deletions

View file

@ -0,0 +1,35 @@
package org.mage.test.cards;
import mage.Constants;
import mage.counters.CounterType;
import mage.players.Player;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class TestElbrusTheBindingBlade extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Air Elemental");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elbrus, the Binding Blade");
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {1}", "Air Elemental");
attack(1, playerA, "Air Elemental");
setStopAt(1, Constants.PhaseStep.END_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 15);
assertPermanentCount(playerA, "Air Elemental", 1);
assertPermanentCount(playerA, "Elbrus, the Binding Blade", 0);
assertPermanentCount(playerA, "Withengar Unbound", 1);
}
}

View file

@ -0,0 +1,38 @@
package org.mage.test.cards;
import junit.framework.Assert;
import mage.Constants;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class TestZombieApocalypse extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp", 6);
addCard(Constants.Zone.HAND, playerA, "Zombie Apocalypse");
addCard(Constants.Zone.GRAVEYARD, playerA, "Bog Raiders", 2);
addCard(Constants.Zone.GRAVEYARD, playerA, "Toxic Nim", 1);
addCard(Constants.Zone.BATTLEFIELD, playerA, "White Knight");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Black Knight", 2);
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Zombie Apocalypse");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, 2);
assertGraveyardCount(playerB, 2);
assertPermanentCount(playerA, "Bog Raiders", 2);
assertPermanentCount(playerA, "Toxic Nim", 1);
assertPermanentCount(playerA, "White Knight", 0);
assertPermanentCount(playerA, "Black Knight", 0);
}
}

View file

@ -15,6 +15,7 @@ import org.mage.test.serverside.base.MageTestPlayerBase;
import java.util.List;
import java.util.UUID;
import mage.Constants.PhaseStep;
import mage.counters.CounterType;
import org.mage.test.player.TestPlayer;
/**
@ -351,7 +352,24 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
}
Assert.assertEquals("(Battlefield) Card counts are not equal (" + cardName + ")", count, actualCount);
}
/**
* Assert counter count on a permanent
*
* @param cardName Name of the cards that should be counted.
* @param type Type of the counter that should be counted.
* @param count Expected count.
*/
public void assertCounterCount(String cardName, CounterType type, int count) throws AssertionError {
int actualCount = 0;
for (Permanent permanent : currentGame.getBattlefield().getAllPermanents()) {
if (permanent.getName().equals(cardName)) {
actualCount += permanent.getCounters().getCount(type);
}
}
Assert.assertEquals("(Battlefield) Counter counts are not equal (" + cardName + ":" + type + ")", count, actualCount);
}
/**
* Assert card count in player's hand.
*