Exemplo n.º 1
0
        public void MinChargeTest()
        {
            double      capacity = 3000;
            BaseBattery battery  = new LiIonBattery(capacity, 1500);

            battery.ChargeChanged += DummyMethod;

            battery.Discharge(capacity + 1);

            Assert.AreEqual(0, battery.GetCurrentCharge());
        }
Exemplo n.º 2
0
        public void TaskDischargeTest()
        {
            double      capacity = 3000;
            BaseBattery battery  = new LiIonBattery(capacity, 1500);

            battery.ChargeChanged += DummyMethod;
            double expCharge = 48;
            Task   charge    = new Task(() => {
                battery.Discharge(50);
            }
                                        );

            charge.Start();
            charge.Wait();
            double resCharge = battery.GetCurrentCharge();

            Assert.AreEqual(expCharge, resCharge);
        }