예제 #1
0
파일: UnitTests.cs 프로젝트: DakEnviy/homm
        public void CreateUnitAngel()
        {
            const int hitPoints = 180;
            const int attack    = 27;
            const int defence   = 27;

            (int, int)damage = (45, 45);
            const float initiative = 11.0f;

            Unit unit = new UnitAngel();

            Assert.AreEqual(hitPoints, unit.GetHitPoints());
            Assert.AreEqual(attack, unit.GetAttack());
            Assert.AreEqual(defence, unit.GetDefence());
            Assert.AreEqual(damage, unit.GetDamage());
            Assert.AreEqual(initiative, unit.GetInitiative());
        }
예제 #2
0
        public void CreateBattleUnitsStack()
        {
            Unit      unit   = new UnitAngel();
            const int amount = 128;

            UnitsStack baseStack = new UnitsStack(unit, amount);

            BattleUnitsStack stack = new BattleUnitsStack(baseStack, null);

            Assert.AreEqual(baseStack, stack.GetBaseStack());
            Assert.AreEqual(unit, stack.GetBaseUnit());
            Assert.IsNull(stack.GetArmy());
            Assert.AreEqual(amount, stack.GetAmount());
            Assert.AreEqual(unit.GetHitPoints(), stack.GetTopHitPoints());
            Assert.AreEqual(unit.GetAttack(), stack.GetAttack());
            Assert.AreEqual(unit.GetDefence(), stack.GetDefence());
            Assert.AreEqual(unit.GetDamage(), stack.GetDamage());
            Assert.AreEqual(unit.GetInitiative(), stack.GetInitiative());
        }
예제 #3
0
        public void BattleUnitsStack_Setters()
        {
            Unit      unit            = new UnitAngel();
            const int amount          = 128;
            const int newAmount       = 100;
            const int newTopHitPoints = 50;
            const int newAttack       = 10;
            const int newDefence      = 12;

            (int, int)newDamage = (15, 30);
            float newInitiative = 1.1F;

            UnitsStack baseStack = new UnitsStack(unit, amount);

            BattleUnitsStack stack = new BattleUnitsStack(baseStack, null);

            Assert.AreEqual(amount, stack.GetAmount());
            stack.SetAmount(newAmount);
            Assert.AreEqual(newAmount, stack.GetAmount());

            Assert.AreEqual(unit.GetHitPoints(), stack.GetTopHitPoints());
            stack.SetTopHitPoints(newTopHitPoints);
            Assert.AreEqual(newTopHitPoints, stack.GetTopHitPoints());

            Assert.AreEqual(unit.GetAttack(), stack.GetAttack());
            stack.SetAttack(newAttack);
            Assert.AreEqual(newAttack, stack.GetAttack());

            Assert.AreEqual(unit.GetDefence(), stack.GetDefence());
            stack.SetDefence(newDefence);
            Assert.AreEqual(newDefence, stack.GetDefence());

            Assert.AreEqual(unit.GetDamage(), stack.GetDamage());
            stack.SetDamage(newDamage);
            Assert.AreEqual(newDamage, stack.GetDamage());

            Assert.AreEqual(unit.GetInitiative(), stack.GetInitiative());
            stack.SetInitiative(newInitiative);
            Assert.AreEqual(newInitiative, stack.GetInitiative());
        }