コード例 #1
0
        public void ProcessSkill_AttackTest()
        {
            //Initialize necessary instances.
            BattleSimulator battleSim = this.BattleSimulator;

            //A custom attack skill used for the tests.
            Skill attackSkill = new Attack("attack", 1, 25, 999, Target.Opponent);

            //Initialize entities.
            Player player = this.Player;
            Enemy  enemy  = this.Enemy;

            //Give the player enough gauge to use the attack skill.
            player.Gauge = attackSkill.Gauge;
            //Trigger the skill.
            battleSim.ProcessSkill(attackSkill, player, enemy);

            //Verify to see if the player's gauge was consumed, which
            //indicates a successful execution.
            Assert.AreEqual <byte>(0, player.Gauge);

            //Follow up by making sure the enemy took
            //damage from the attack.
            Assert.AreNotEqual <short>(enemy.MaxHp, enemy.Hp);
        }
コード例 #2
0
        public void ProcessSkill_RecoveryTest()
        {
            //Initialize necessary instances.
            BattleSimulator battleSim = this.BattleSimulator;

            //A custom healing skill used for the tests.
            Skill attackSkill = new Heal("Heal", 1, 25, 999, Target.Self);

            //Initialize entities.
            Player player = this.Player;
            Enemy  enemy  = this.Enemy;

            //Give the player enough gauge to use the healing skill.
            player.Gauge = attackSkill.Gauge;

            //Damage the player to verify that Hp gets recovered.
            player.Hp = 1;

            //Damage the enemy to make sure the enemy is not
            //recovering from the skill as well.
            enemy.Hp = 1;

            //Trigger the skill.
            battleSim.ProcessSkill(attackSkill, player, enemy);

            //Verify to see if the player's gauge was consumed, which
            //indicates a successful execution.
            Assert.AreEqual <byte>(0, player.Gauge);

            //Follow up by making sure the player recovered Hp.
            Assert.IsTrue(player.Hp > 1);

            //Check to make sure the healing effects were not
            //also applied to the enemy's Hp.
            Assert.AreEqual <short>(1, enemy.Hp);
        }