Exemple #1
0
        public void BattleArmy_GetStacksByUnitType()
        {
            Unit angel    = Units.Units.GetUnit("angel");
            Unit skeleton = Units.Units.GetUnit("skeleton");

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

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

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

            IList <BattleUnitsStack> angels    = army.GetStacksByUnit(angel);
            IList <BattleUnitsStack> skeletons = army.GetStacksByUnit(skeleton);

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