Exemplo n.º 1
0
        public void TestSummonAction()
        {
            ActionFactory factory = new ActionFactory();

            factory.IsDraft = false;

            SummonAction action = factory.CreateGameAction("SUMMON 0") as SummonAction;

            Assert.IsNotNull(action);
            Assert.IsInstanceOfType(action, typeof(SummonAction));
        }
Exemplo n.º 2
0
        public void GivenPlayerHasEmptyBoard_ThenWindspeakerCanStillBeSummonned()
        {
            var windspeaker = Minions.WindSpeaker;
            var gameState   = GameState.Empty.With(
                PlayerGameState.Empty.With(_player, hand: x => x.AddCard(windspeaker), remainingMana: x => windspeaker.ManaCost));
            var expected = new SummonAction(_player, windspeaker).Yield();

            var actual = _testee.GetAllSummonActions(gameState, _player);

            CollectionAssert.AreEquivalent(expected, actual);
        }
        GivenBoardIsEmpty_WhenSummonMinionActionRequested_ThenCardRemovedFromHandAndManaDecresedAndMinionOboard()
        {
            var minionCard = new MinionCard(5, 1, 1);
            var gameState  = GameState.Empty.With(
                PlayerGameState.Empty.With(_player, remainingMana: x => 7, hand: x => x.AddCard(minionCard)));

            var action = new SummonAction(_player, minionCard);

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

            Assert.IsFalse(newGameState.Of(_player).Hand.Any());
            Assert.AreEqual(7 - 5, newGameState.Of(_player).RemainingMana);
            Assert.IsTrue(newGameState.Of(_player).Minions.Count() == 1);
        }
        public void GivenSenjinInHand_WhenSummonSenjin_ThenSenjinOnboard()
        {
            var senjin    = Minions.SenjinShieldmasta;
            var gameState = GameState.Empty.With(
                PlayerGameState.Empty.With(_player, hand: x => x.AddCard(senjin), remainingMana: x => senjin.ManaCost));

            var action = new SummonAction(_player, senjin);

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

            var onboardSenjin = newState.Of(_player).Minions.FirstOrDefault();

            Assert.IsNotNull(onboardSenjin);
            Assert.AreEqual(senjin.Attack, onboardSenjin.Attack);
            Assert.AreEqual(senjin.Health, onboardSenjin.Health);
        }
Exemplo n.º 5
0
        private void RunInvalidSummonCreatureTest(int id)
        {
            int expectedMyHealth    = player1.Data.Health;
            int expectedOppHealth   = player2.Data.Health;
            int expectedNextDraw    = player1.NextDrawSize;
            int expectedPlayerTable = player1.Table.Count;
            int expectedPlayerHand  = player1.Hand.Count;

            SummonAction action = new SummonAction(id);
            bool         result = action.Execute(player1, player2);

            Assert.IsTrue(result);
            Assert.AreEqual(expectedMyHealth, player1.Data.Health);
            Assert.AreEqual(expectedOppHealth, player2.Data.Health);
            Assert.AreEqual(expectedNextDraw, player1.NextDrawSize);
            Assert.AreEqual(expectedPlayerHand, player1.Hand.Count);
            Assert.AreEqual(expectedPlayerTable, player1.Table.Count);
        }
Exemplo n.º 6
0
        private void RunSummonCreatureTest(int id)
        {
            Card card = player1.Hand[id];

            player1.Mana = card.Cost;

            int expectedMyHealth    = player1.Data.Health + card.MyHealthChange;
            int expectedOppHealth   = player2.Data.Health + card.OppHealthChange;
            int expectedNextDraw    = player1.NextDrawSize + card.Draw;
            int expectedPlayerTable = Math.Min(player1.Table.Count + 1, MAX_ON_TABLE);
            int expectedPlayerHand  = player1.Hand.Count - 1;

            SummonAction action = new SummonAction(id);
            bool         result = action.Execute(player1, player2);

            Assert.IsTrue(result);
            Assert.AreEqual(expectedMyHealth, player1.Data.Health);
            Assert.AreEqual(expectedOppHealth, player2.Data.Health);
            Assert.AreEqual(expectedNextDraw, player1.NextDrawSize);
            Assert.AreEqual(expectedPlayerTable, player1.Table.Count);
            Assert.AreEqual(expectedPlayerHand, player1.Hand.Count);
            Assert.AreEqual(card.IsCharge, player1.Table[id].CanAttack);
        }