public void ChargeLevelTooHighTest() { MobileLab5 mob = new MobileLab5(new SmsReceiver()); BatteryWithThreads battery = new BatteryWithThreads(); battery.ChargeLevel = 100; battery.IsCharging = true; battery.StartThreads(new ProgressBar()); Thread.Sleep(3500); Assert.IsTrue(battery.ChargeLevel == 100); }
public void BatteryUsingWithThreadsTest() { MobileLab5 mob = new MobileLab5(new SmsReceiver()); BatteryWithThreads battery = new BatteryWithThreads(); int startingChargeLevel = battery.ChargeLevel; battery.StartThreads(new ProgressBar()); Thread.Sleep(3500); bool expectedTrue = startingChargeLevel > battery.ChargeLevel; expectedTrue = expectedTrue && (startingChargeLevel - 5) < battery.ChargeLevel; Assert.IsTrue(expectedTrue); }