public void PushDown_CurrentState_ShouldTargetState(LampState currentState, LampState expectedState) { // Arrange ProxyLamp lamp = new ProxyLamp(new LampStateMachine(messageService, initialState: currentState)); // Act lamp.PushDown(); // Assert lamp.State.Should().Be(expectedState); }
public void PushUp_LampStateOff_ShouldTargetState(string currentTime, LampState expectedState) { ITimeService timeService = Mock.Of <ITimeService>(ts => ts.TimeOfDay == TimeSpan.Parse(currentTime)); // Arrange ProxyLamp lamp = new ProxyLamp(new LampStateMachine(messageService, timeService)); // Act lamp.PushUp(); // Assert lamp.State.Should().Be(expectedState); }
public void TimerElapsed_LampStateOn_ShouldLampStateOff() { Mock <ITimerService> mockTimer = new Mock <ITimerService>(); // Arrange ProxyLamp lamp = new ProxyLamp(new LampStateMachine(messageService, timer: mockTimer.Object)); // Act lamp.PushUp(); mockTimer.Raise(m => m.Elapsed += null, EventArgs.Empty); // Assert lamp.State.Should().Be(LampState.Off); }