public void FinalHqDeath() { Engine engine = new Engine(); Logger logger = new Logger(engine); Manage manage = new Manage(engine); engine.Triggers.Register <FinalDeckOut>(); engine.Triggers.Register <FinalHqDeath>(); var final = new FinalListener(engine); var player = engine.Chiefs[0]; var enemy = engine.Chiefs[1]; var HQ = player.Cards.Factory.CreateDefaultHq <HqGuards>(); var Spg1 = enemy.Cards.Factory.Create <TankBigSpg>(); var Spg2 = enemy.Cards.Factory.Create <TankBigSpg>(); manage.Position(Spg1, engine.Field.GetCell(2, 2)); manage.Position(Spg2, engine.Field.GetCell(1, 2)); manage.StartGame(enemy); manage.Fight(Spg1, HQ); Assert.IsFalse(HQ.IsDead()); Assert.AreEqual(null, final.action); manage.Fight(Spg2, HQ); Assert.IsTrue(HQ.IsDead()); Assert.AreNotEqual(null, final.action); Assert.AreEqual(1, final.count); Assert.AreEqual(final.action.trigger, Final.Trigger.HqDeath); }
public void FinalDeckOut() { Engine engine = new Engine(); Logger logger = new Logger(engine); Manage manage = new Manage(engine); var final = new FinalListener(engine); var player = engine.Chiefs[0]; var enemy = engine.Chiefs[1]; engine.Triggers.Register <CardAutoDraw>(); engine.Triggers.Register <FinalDeckOut>(); engine.Triggers.Register <FinalHqDeath>(player); engine.Triggers.Register <FinalHqDeath>(enemy); for (int i = 0; i < 10; i++) { player.Cards.Factory.Create <TankLight>(); enemy.Cards.Factory.Create <TankLight>(); } manage.Draw(player, 8); manage.Draw(enemy, 6); manage.StartGame(player); manage.EndTurn(player); manage.EndTurn(enemy); // 1 card in player deck manage.EndTurn(player); manage.EndTurn(enemy); Assert.AreEqual(null, final.action); Assert.AreEqual(0, player.Cards.CountLocation(Location.Deck)); manage.EndTurn(player); Assert.AreEqual(null, final.action); Assert.AreEqual(0, player.Cards.CountLocation(Location.Deck)); manage.EndTurn(enemy); Assert.AreNotEqual(null, final.action); Assert.AreEqual(1, final.count); Assert.AreEqual(Final.Trigger.DeckOut, final.action.trigger); Assert.AreSame(enemy, final.action.Winner); }