Exemplo n.º 1
0
        public void ChargerThreadDischargeTest()
        {
            var battery = new Battery();

            Assert.AreEqual(100, battery.Charge);
            var charger = new ChargerThread(battery);

            Thread.Sleep(2000);
            Assert.IsTrue(100 > battery.Charge);
            charger.FinalyzeCharge();
        }
 public void ChargeLevelIncreasingByThreadTest() {
     //Arrange
     LiPoBattery battery = new LiPoBattery(5000, 3.7, 95);
     int expectedResult = 100;
     ChargerThread chargerThread = new ChargerThread(battery);
     //Act
     chargerThread.Start();
     Thread.Sleep(10);
     int actualResult = battery.ChargeLevel;
     chargerThread.Stop();
     //Assert
     Assert.AreEqual(expectedResult, actualResult);
 }