public void MultiButtonRemoteWithMultipleLightsTest() { var kitchenLight = MockRepository.GenerateMock <ILight>(); var kitchenLightOnCommand = new LightOnCommand(kitchenLight); var kitchenLightOffCommand = new LightOffCommand(kitchenLight); var livingRoomLight = MockRepository.GenerateMock <ILight>(); var livingRoomLightOnCommand = new LightOnCommand(livingRoomLight); var livingRoomLightOffCommand = new LightOffCommand(livingRoomLight); MultiButtonRemote remote = new MultiButtonRemote(); remote.SetSlot(0, kitchenLightOnCommand, kitchenLightOffCommand); remote.SetSlot(1, livingRoomLightOnCommand, livingRoomLightOffCommand); remote.PushOnButton(0); kitchenLight.AssertWasCalled(x => x.On()); remote.PushOnButton(1); livingRoomLight.AssertWasCalled(x => x.On()); remote.PushOffButton(0); kitchenLight.AssertWasCalled(x => x.Off()); remote.PushOffButton(1); kitchenLight.AssertWasCalled(x => x.Off()); }
public void MultiButtonRemoteWithMultipleLightsTest() { var kitchenLight = MockRepository.GenerateMock<ILight>(); var kitchenLightOnCommand = new LightOnCommand(kitchenLight); var kitchenLightOffCommand = new LightOffCommand(kitchenLight); var livingRoomLight = MockRepository.GenerateMock<ILight>(); var livingRoomLightOnCommand = new LightOnCommand(livingRoomLight); var livingRoomLightOffCommand = new LightOffCommand(livingRoomLight); MultiButtonRemote remote = new MultiButtonRemote(); remote.SetSlot(0, kitchenLightOnCommand, kitchenLightOffCommand); remote.SetSlot(1, livingRoomLightOnCommand, livingRoomLightOffCommand); remote.PushOnButton(0); kitchenLight.AssertWasCalled(x => x.On()); remote.PushOnButton(1); livingRoomLight.AssertWasCalled(x => x.On()); remote.PushOffButton(0); kitchenLight.AssertWasCalled(x => x.Off()); remote.PushOffButton(1); kitchenLight.AssertWasCalled(x => x.Off()); }