commit 69836fd998e1d7bf8cefd9c12607d115b63d07dc parent fb8582119800d4687a7437a8d93d055737a717be Author: Sebastiano Tronto <sebastiano@tronto.net> Date: Sun, 28 May 2023 21:48:16 +0200 [RED] Add set point -> required temperature changed Diffstat:
M | thermostat.py | | | 12 | ++++++++++++ |
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/thermostat.py b/thermostat.py @@ -5,9 +5,21 @@ class Thermostat: def GetCurrentRequiredTemperature(self): return 10 +class TestableThermostat(Thermostat): + + def __init__(self, hour): + self.hour = hour + class ThermostatTests(unittest.TestCase): def test_GivenNewThermostat_ThenRequiredTemperatureIs10(self): thermostat = Thermostat() currentRequiredTemperature = thermostat.GetCurrentRequiredTemperature() self.assertEqual(currentRequiredTemperature, 10) + + def test_GivenIAddedASetPoint_WhenTimeIsAfterSetPoint_ThenRequiredTemperatureIsChanged(self): + hour = 10 + requiredTemperature = 30 + thermostat = TestableThermostat(hour) + thermostat.AddSetPoint(hour, temperature) + self.assertEqual(thermostat.GetCurrentRequiredTemperature(), requiredTemperature)