コード例 #1
0
 def test_initialization(self):
     switch = LightSwitch()
     assert isinstance(switch, LightSwitch)
     assert isinstance(switch, Switchable)
コード例 #2
0
 def _construct_light_switch_client():
     switch = LightSwitch()
     open_command = OpenSwitchCommand(switch)
     close_command = CloseSwitchCommand(switch)
     return Client(open_command, close_command)
コード例 #3
0
 def test_execute_open_switch_command_with_light_switch(self):
     command = OpenSwitchCommand(LightSwitch())
     assert command.execute() == "The light turned off."
コード例 #4
0
 def test_initialization(self):
     command = OpenSwitchCommand(LightSwitch())
     assert isinstance(command, OpenSwitchCommand)
     assert isinstance(command, Command)
コード例 #5
0
 def test_execute_close_switch_command_with_light_switch(self):
     command = CloseSwitchCommand(LightSwitch())
     assert command.execute() == "The light turned on."
コード例 #6
0
 def test_turn_off_light_switch(self):
     switch = LightSwitch()
     assert switch.turn_off() == "The light turned off."
コード例 #7
0
 def test_turn_on_light_switch(self):
     switch = LightSwitch()
     assert switch.turn_on() == "The light turned on."