public void GivenRaptorOnboard_WhenRaptorRecievesOneDamageAndGetsBuffedAndGetsDispelled_ThenRaptorIsDamaged()
        {
            var raptor    = new Minion(Minions.BloodfenRaptor);
            var gameState = GameState.Empty.With(
                PlayerGameState.Empty.With(_player,
                                           hand: x => x.With(new[] { Minions.ShatteredSunCleric, Minions.ElvenArcher, Minions.Spellbreaker }),
                                           minions: x => x.Add(raptor), remainingMana: x => 10));

            var oneDamageAction = new SummonBattlecryTargetable(_player, Minions.ElvenArcher, raptor);
            var newState        = _testee.ApplyAction(gameState, oneDamageAction);
            var damagedRaptor   = newState.Of(_player).Minions.Last();

            var buffAction = new SummonBattlecryTargetable(_player, Minions.ShatteredSunCleric, damagedRaptor);

            newState = _testee.ApplyAction(newState, buffAction);
            var damagedBuffedRaptor = newState.Of(_player).Minions.Last();

            var silenceAction = new SummonBattlecryTargetable(_player, Minions.Spellbreaker, damagedBuffedRaptor);

            newState = _testee.ApplyAction(newState, silenceAction);
            var silencedRaptor = newState.Of(_player).Minions.Last();

            Assert.IsTrue(silencedRaptor.IsDamaged);
            Assert.IsTrue(damagedBuffedRaptor.IsDamaged);
        }
        public void GivenMinionIsDamagedByOne_WhenHealedByFive_ThenOnlyOneHealthIsRestored()
        {
            var damagedMinion = new Minion(0, 5, healthCurrent: 4);
            var gameState     = GameState.Empty.With(
                PlayerGameState.Empty.With(_player, hand: x => x.AddCard(Minions.VoodooDoctor), minions: x => x.Add(damagedMinion), remainingMana: x => 10));
            var healAction = new SummonBattlecryTargetable(_player, Minions.VoodooDoctor, damagedMinion);

            var newState = _testee.ApplyAction(gameState, healAction);

            Assert.IsTrue(newState.Of(_player).Minions.Last().Health == 5);
        }
        public void GivenFrostElementalInHand_WhenSummonTargetingSelf_ThenSelfHasStatusFrozen()
        {
            var elemental = Minions.FrostElemental;
            var gameState = GameState.Empty.With(
                PlayerGameState.Empty.With(_player, hand: x => x.AddCard(elemental), remainingMana: x => elemental.ManaCost));

            var action = new SummonBattlecryTargetable(_player, elemental, gameState.Of(_player).Face);

            var newState = _testee.ApplyAction(gameState, action);

            Assert.IsTrue(newState.Of(_player).Minions.Count == 1);
            Assert.IsTrue(newState.Of(_player).Face.HasStatus(Status.Frozen));
        }
        public void GivenSpellbreakerInHand_WhenSummonedTargetingMinion_ThenMinionGotEffectsDispelled()
        {
            var          spellbreaker    = Minions.Spellbreaker;
            const Status status          = Status.Taunt | Status.Frozen;
            var          enchantedMinion = new Minion(0, 5, status);
            var          gameState       = GameState.Empty.With(
                PlayerGameState.Empty.With(_player, hand: x => x.AddCard(spellbreaker), minions: x => x.Add(enchantedMinion), remainingMana: x => spellbreaker.ManaCost));

            var action = new SummonBattlecryTargetable(_player, spellbreaker, enchantedMinion, 1);

            var newState = _testee.ApplyAction(gameState, action);

            Assert.IsFalse(newState.Of(_player).Minions.First().HasStatus(status));
        }
        public void GivenVoodooDoctorInHand_WhenSummonDoctorTargetingSelf_ThenSelfHasTwoHpHealed()
        {
            var doctor    = Minions.VoodooDoctor;
            var face      = Face.Empty.With(health: 15);
            var gameState = GameState.Empty.With(
                PlayerGameState.Empty.With(_player, hand: x => x.AddCard(doctor), remainingMana: x => doctor.ManaCost,
                                           face: x => face));

            var action = new SummonBattlecryTargetable(_player, doctor, face);

            var newState = _testee.ApplyAction(gameState, action);

            Assert.IsTrue(newState.Of(_player).Minions.Count == 1);
            Assert.IsTrue(newState.Of(_player).Face.Health == face.Health + 2);
        }
        public void GivenElvenArcherInHand_WhenSummonArcherTargetingOpponent_ThenOpponentHasMinusOneHealth()
        {
            var archer    = Minions.ElvenArcher;
            var bFace     = Face.Empty;
            var gameState = GameState.Empty.With(
                PlayerGameState.Empty.With(_player, hand: x => x.AddCard(archer), remainingMana: x => archer.ManaCost),
                PlayerGameState.Empty.With(face: x => bFace));

            var action = new SummonBattlecryTargetable(_player, archer, bFace);

            var newState = _testee.ApplyAction(gameState, action);

            Assert.IsTrue(newState.Of(_player).Minions.Count == 1);
            Assert.IsTrue(newState.OfOpponent(_player).Face.Health == bFace.Health - 1);
        }