Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }