public void AttackTest() { MeleeUnit testAttacker = new MeleeUnit(100, 10, 10, float.MaxValue); MeleeUnit testDefender = new MeleeUnit(100, 10, 10, float.MaxValue); testAttacker.AttackCost = 1; testAttacker.IsNotTesting = false; testAttacker.Attack(testDefender); int expected = 90; int actual = testDefender.Health; Assert.AreEqual(expected, actual); }
public void AttackIfAPIsGreaterThanAC() { MeleeUnit testAttacker = new MeleeUnit(100, 10, 10, float.MaxValue); MeleeUnit testDefender = new MeleeUnit(100, 10, 10, float.MaxValue); testAttacker.AttackCost = 3; testAttacker.IsNotTesting = false; testAttacker.Attack(testDefender); int expectedAC = 7; int actualAC = testAttacker.ActionPoints; int expctedHP = 90; int actualHP = testDefender.Health; Assert.AreEqual(expectedAC, actualAC); Assert.AreEqual(expctedHP, actualHP); }
public void NoAttackIfACIsZero() { MeleeUnit testAttacker = new MeleeUnit(100, -100, 10, float.MaxValue); MeleeUnit testDefender = new MeleeUnit(100, 10, 10, float.MaxValue); testAttacker.AttackCost = 0; testAttacker.IsNotTesting = false; testAttacker.Attack(testDefender); int expectedAP = 10; int actualAP = testAttacker.ActionPoints; int expected = 100; int actual = testDefender.Health; Assert.AreEqual(expectedAP, actualAP); Assert.AreEqual(expected, actual); }
public void NoDamageWhenLessThanZero() { MeleeUnit testAttacker = new MeleeUnit(100, -100, 10, float.MaxValue); MeleeUnit testDefender = new MeleeUnit(100, 10, 10, float.MaxValue); testAttacker.AttackCost = 1; testAttacker.IsNotTesting = false; testAttacker.Attack(testDefender); int expected = 100; int actual = testDefender.Health; Assert.AreEqual(expected, actual); }
public void NoAttackIfAPIsLessThanAC() { MeleeUnit testAttacker = new MeleeUnit(100, 100, 10, float.MaxValue); MeleeUnit testDefender = new MeleeUnit(100, 10, 10, float.MaxValue); testAttacker.AttackCost = 11; testAttacker.IsNotTesting = false; testAttacker.Attack(testDefender); int expectedAP = 10; int actualAP = testAttacker.ActionPoints; int expectedHealth = 100; int actualHealth = testDefender.Health; Assert.AreEqual(expectedAP, actualAP); Assert.AreEqual(expectedHealth, actualHealth); }