diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromColorTest.java b/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromColorTest.java new file mode 100644 index 00000000000..6ba6a374b71 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromColorTest.java @@ -0,0 +1,55 @@ +package org.mage.test.serverside.cards.abilities; + +import mage.Constants; +import mage.filter.Filter; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestAPI; +import org.mage.test.serverside.base.CardTestBase; + +/** + * @author ayratn + */ +public class ProtectionFromColorTest extends CardTestBase { + + @Test + public void testAgainstAbilityInTheStack() { + useRedDefault(); + addCard(Constants.Zone.BATTLEFIELD, computerA, "Royal Assassin"); + + // tapped White Knight with Protection from Black + addCard(Constants.Zone.BATTLEFIELD, computerB, "White Knight", 1, true); + // one not tapped White Knight to prevent AI from attacking + addCard(Constants.Zone.BATTLEFIELD, computerB, "White Knight", 1, false); + + setStopOnTurn(2); + execute(); + + assertTurn(2); + assertResult(computerA, CardTestAPI.GameResult.DRAW); + assertLife(computerA, 20); + assertLife(computerB, 20); + + // no one should be destroyed + assertPermanentCount(computerB, "White Knight", 2); + } + + @Test + public void testAgainstAbilityInTheStackNoProtection() { + useRedDefault(); + addCard(Constants.Zone.BATTLEFIELD, computerA, "Royal Assassin"); + + addCard(Constants.Zone.BATTLEFIELD, computerB, "Runeclaw Bear", 1, true); + addCard(Constants.Zone.BATTLEFIELD, computerB, "Runeclaw Bear", 1, false); + + setStopOnTurn(2); + execute(); + + assertTurn(2); + assertResult(computerA, CardTestAPI.GameResult.DRAW); + assertLife(computerA, 20); + assertLife(computerB, 20); + + // One should have beendestroyed by Royal Assassin + assertPermanentCount(computerB, "Runeclaw Bear", 1); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java b/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java new file mode 100644 index 00000000000..849c2cc330b --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/serverside/cards/abilities/ProtectionFromTypeTest.java @@ -0,0 +1,49 @@ +package org.mage.test.serverside.cards.abilities; + +import mage.Constants; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestBase; + +/** + * @author ayratn + */ +public class ProtectionFromTypeTest extends CardTestBase { + + @Test + public void testProtectionFromArtifacts() { + useRedDefault(); + addCard(Constants.Zone.HAND, computerA, "Trigon of Corruption"); + + addCard(Constants.Zone.BATTLEFIELD, computerB, "Tel-Jilad Fallen"); + + setStopOnTurn(2); + execute(); + + assertTurn(2); + assertResult(computerA, GameResult.DRAW); + assertLife(computerA, 20); + assertLife(computerB, 20); + + // no one should be destroyed + assertPermanentCount(computerB, "Tel-Jilad Fallen", 1); + } + + @Test + public void testNoProtection() { + useRedDefault(); + addCard(Constants.Zone.HAND, computerA, "Trigon of Corruption"); + + addCard(Constants.Zone.BATTLEFIELD, computerB, "Coral Merfolk"); + + setStopOnTurn(2); + execute(); + + assertTurn(2); + assertResult(computerA, GameResult.DRAW); + assertLife(computerA, 20); + assertLife(computerB, 20); + + // no one should be destroyed + assertPermanentCount(computerB, "Coral Merfolk", 0); + } +}