public void hit_decreases_hp_properly() { var tank = new Tank(); var initialHealth = tank.Health; tank.Hit(10); Assert.AreEqual(initialHealth-10, tank.Health); }
public void hit_received_is_fired() { var tank = new Tank(); bool eventFired = false; int healthAfterHit = 0; tank.HitReceived += (sender, currentHealth) => { eventFired = true; healthAfterHit = currentHealth; }; var initialHealth = tank.Health; const int hitVal = 50; tank.Hit(hitVal); Assert.That(eventFired); Assert.AreEqual(initialHealth-hitVal, healthAfterHit); }
public void hp_equals_100_after_repairs() { var tank = new Tank(); tank.Hit(96); _mechanic.Repair(tank); Assert.AreEqual(100, tank.Health); }
public void cannot_fix_tank_with_hp_less_than_1() { var tank = new Tank(); tank.Hit(tank.Health); Assert.Throws<Exception>(() => _mechanic.Repair(tank)); }
public void hp_cannot_be_negative() { var tank = new Tank(); Assert.Throws<Exception>(() => tank.Hit(tank.Health*2)); }