public void EnergyUsed_WHEN_timeOn_positive_THEN_equals_wattage_times_hoursOn_dividedby_1000(TimeSpan timeOn, int myWattage) { const int lumens = 500; var expected = timeOn.TotalHours * myWattage / 1000; // EnergyUsed read in KwH. LightbulbBase bulb = new TestBulb(lumens, myWattage); var actual = bulb.EnergyUsed(timeOn); Assert.Equal(expected, actual); }
public void EnergyUsed_TenWattageFiveHours_PointZeroFiveKwh() { const int wattage = 10; var timeOn = TimeSpan.FromHours(5); var expected = wattage * timeOn.TotalHours / 1000; LightbulbBase bulb = new TestBulb(500, wattage); var actual = bulb.EnergyUsed(timeOn); Assert.Equal(expected, actual); }