public void Test_BattleSim_Player_Defends(int playerAction, string Pname, int Phealth, int Pdamage, int enemyAction, string Ename, int Eheath, int Edamage) { //Setup Player player = new Player(Pname, Phealth, Pdamage); Enemy enemy = new Enemy(Ename, Eheath, Edamage); BattleFunc battleFunc = new BattleFunc(); //Execute battleFunc.BattleSimulation(playerAction, enemyAction, player, enemy); //Assert Assert.AreEqual(player.MaxHp - (enemy.Damage * 0.8), player.CurrentHp); }
public void Test_BattleSim_Enemy_Heals(int playerAction, string Pname, int Phealth, int Pdamage, int enemyAction, string Ename, int Eheath, int Edamage) { //Setup Player player = new Player(Pname, Phealth, Pdamage); Enemy enemy = new Enemy(Ename, Eheath, Edamage); BattleFunc battleFunc = new BattleFunc(); //Expected result float expectedRemainingHealth = enemy.CurrentHp - player.Attack() + (enemy.MaxHp * 0.2f); if (enemy.MaxHp <= expectedRemainingHealth) { expectedRemainingHealth = enemy.MaxHp; } //Execute battleFunc.BattleSimulation(playerAction, enemyAction, player, enemy); //Assert Assert.AreEqual(expectedRemainingHealth, enemy.CurrentHp); }