public void WhenThereAreNoLastBuildStatusResults_SignalLightIsTurnedOff() { var signalLightControllerMock = new Mock <IControlSignalLight>(); var controller = new BuildStatusLightController(signalLightControllerMock.Object); var lastBuildStatusses = new LastBuildsStatus { AggregatedBuildStatus = AggregatedBuildStatus.None }; controller.SetSignalLight(lastBuildStatusses); signalLightControllerMock.Verify(x => x.TurnOffAll(), Times.Once); }
public void WhenLastBuildSucceededAndBuildInProgress_SignalLightIsFlashingGreen() { var signalLightControllerMock = new Mock <IControlSignalLight>(); var controller = new BuildStatusLightController(signalLightControllerMock.Object); var lastBuildStatusses = new LastBuildsStatus { AggregatedBuildResult = AggregatedBuildResult.Succeeded, AggregatedBuildStatus = AggregatedBuildStatus.InProgress }; controller.SetSignalLight(lastBuildStatusses); signalLightControllerMock.Verify(x => x.TurnOffAll(), Times.Once); signalLightControllerMock.Verify(x => x.TurnOnColor(SignalLightColor.Green, It.IsAny <byte>(), true), Times.Once); }
public void WhenLastBuildFailedAndNoBuildInProgress_SignalLightIsTurnedRed() { var signalLightControllerMock = new Mock <IControlSignalLight>(); var controller = new BuildStatusLightController(signalLightControllerMock.Object); var lastBuildStatusses = new LastBuildsStatus { AggregatedBuildResult = AggregatedBuildResult.Failed, AggregatedBuildStatus = AggregatedBuildStatus.Completed }; controller.SetSignalLight(lastBuildStatusses); signalLightControllerMock.Verify(x => x.TurnOffAll(), Times.Once); signalLightControllerMock.Verify(x => x.TurnOnColor(SignalLightColor.Red, It.IsAny <byte>(), false), Times.Once); }