예제 #1
0
파일: ChargeTest.cs 프로젝트: TRSASC/Lab5
        public void MaxChargeTest()
        {
            double      capacity = 3000;
            BaseBattery battery  = new LiIonBattery(capacity, 1500);

            battery.ChargeChanged += DummyMethod;

            battery.Charge(capacity + 1);

            Assert.AreEqual(100, battery.GetCurrentCharge());
        }
예제 #2
0
파일: ChargeTest.cs 프로젝트: TRSASC/Lab5
        public void TaskChargeTest()
        {
            double      capacity = 3000;
            BaseBattery battery  = new LiIonBattery(capacity, 1500);

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

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

            Assert.AreEqual(expCharge, resCharge);
        }