Esempio n. 1
0
        public void BattleArmy_ContainsStack()
        {
            Unit angel    = new UnitAngel();
            Unit skeleton = new UnitSkeleton();

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

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

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

            BattleUnitsStack stack3 = new BattleUnitsStack(new UnitsStack(skeleton, 42), army);

            army.AddStack(stack3);
            Assert.IsTrue(army.ContainsStack(stack3));
        }
Esempio n. 2
0
        public void BattleArmy_AddStack()
        {
            Unit angel    = new UnitAngel();
            Unit skeleton = new UnitSkeleton();

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

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

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

            BattleUnitsStack stack3  = new BattleUnitsStack(new UnitsStack(skeleton, 42), army);
            BattleUnitsStack stack4  = new BattleUnitsStack(new UnitsStack(skeleton, 42), army);
            BattleUnitsStack stack5  = new BattleUnitsStack(new UnitsStack(skeleton, 42), army);
            BattleUnitsStack stack6  = new BattleUnitsStack(new UnitsStack(skeleton, 42), army);
            BattleUnitsStack stack7  = new BattleUnitsStack(new UnitsStack(skeleton, 42), army);
            BattleUnitsStack stack8  = new BattleUnitsStack(new UnitsStack(skeleton, 42), army);
            BattleUnitsStack stack9  = new BattleUnitsStack(new UnitsStack(skeleton, 42), army);
            BattleUnitsStack stack10 = new BattleUnitsStack(new UnitsStack(skeleton, 42), army);

            Assert.AreEqual(2, army.GetStacks().Count);
            army.AddStack(stack3);
            Assert.AreEqual(3, army.GetStacks().Count);
            Assert.AreEqual(stack3, army.GetStack(2));
            army.AddStack(stack4);
            army.AddStack(stack5);
            army.AddStack(stack6);
            army.AddStack(stack7);
            army.AddStack(stack8);
            army.AddStack(stack9);
            Assert.AreEqual(9, army.GetStacks().Count);
            Assert.Throws <ArgumentOutOfRangeException>(() => army.AddStack(stack10));
        }