public void TestThreadBasedChargeBottomBoundsInOneUpdate() { BatteryBase battery = new ThreadBasedBattery(); battery.UpdateCharge(-101); Assert.IsTrue(battery.Charge <= 100 && battery.Charge >= 0); }
public void TestThreadBasedChargeBottomBoundsInManyUpdates() { BatteryBase battery = new ThreadBasedBattery(); for (int i = 0; i < 101; i++) { battery.UpdateCharge(-1); } Assert.IsTrue(battery.Charge <= 100 && battery.Charge >= 0); }