예제 #1
0
        public void BattleArmy_GetStacks()
        {
            Unit angel    = new UnitAngel();
            Unit skeleton = new UnitSkeleton();

            UnitsStack stack1 = new UnitsStack(angel, 10);
            UnitsStack stack2 = new UnitsStack(skeleton, 42);
            UnitsStack stack3 = new UnitsStack(angel, 42);

            List <UnitsStack> stacks = new List <UnitsStack> {
                stack1, stack2, stack3
            };

            Army       baseArmy = new Army(stacks);
            BattleArmy army     = new BattleArmy(baseArmy, null);

            army.GetStack(0).SetHitPoints(0);

            IList <BattleUnitsStack> aliveStacks = army.GetAliveStacks();
            IList <BattleUnitsStack> deadStacks  = army.GetDeadStacks();

            Assert.AreEqual(2, aliveStacks.Count);
            Assert.AreEqual(stack2, aliveStacks[0].GetBaseStack());
            Assert.AreEqual(stack3, aliveStacks[1].GetBaseStack());
            Assert.AreEqual(1, deadStacks.Count);
            Assert.AreEqual(stack1, deadStacks[0].GetBaseStack());
        }