示例#1
0
        public void TestCharge_PassLowerValues_ShouldSetBatteryPercentageZero(int lowerPercentage)
        {
            var battery = new LaptopBattery();

            battery.Charge(lowerPercentage);

            Assert.AreEqual(battery.PercentagePowerLeft, 0);
        }
示例#2
0
        public void TestCharge_PassHigherValues_ShouldSetBatteryPercentageHundred(int higherPercentage)
        {
            var battery = new LaptopBattery();

            battery.Charge(higherPercentage);

            Assert.AreEqual(battery.PercentagePowerLeft, 100);
        }
示例#3
0
        public void TestCharge_PassValuesInRange_ShouldSetBatteryPercentageCorrectly(int percentage)
        {
            var battery = new LaptopBattery();
            var currentPercentage = battery.PercentagePowerLeft;

            battery.Charge(percentage);
            var expected = percentage + currentPercentage;

            Assert.AreEqual(battery.PercentagePowerLeft, expected);
        }