public void BatteryConsuming_GoodExample() { Battery battery1 = new Battery() { BatteryID = "a", MaxPower = 10, MaxCapacity = 20, CurrentCapacity = 5, Mode = EMode.NONE, }; double startingCapacity = battery1.CurrentCapacity; battery1.Consuming(); if (Math.Round((battery1.CurrentCapacity * 60 + 1) / (double)60, 2) <= battery1.MaxCapacity) { Assert.AreEqual(Math.Round((startingCapacity * 60 + 1) / (double)60, 2), battery1.CurrentCapacity); Assert.AreEqual(battery1.Mode, EMode.CONSUMING); } else { Assert.AreEqual(battery1.Mode, EMode.NONE); } }