public void TestThreadBasedChargeBottomBoundsInOneUpdate() { BatteryBase battery = new ThreadBasedBattery(); battery.UpdateCharge(-101); Assert.IsTrue(battery.Charge <= 100 && battery.Charge >= 0); }
public void TestDischargingThreadBased() { BatteryBase battery = new ThreadBasedBattery(); int startCharge = battery.Charge; Thread.Sleep(3000); Assert.IsTrue(battery.Charge < startCharge); }
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); }