public void ChangeIndicator(DelcomIndicatorState newState) { if (state != newState) { logger.Debug("Change Delcom build light to {0}", newState); AllOff(); switch (newState) { case DelcomIndicatorState.SolidGreen: GreenOn(); break; case DelcomIndicatorState.SolidRed: RedOn(); break; case DelcomIndicatorState.SolidBlue: BlueOn(); break; case DelcomIndicatorState.FlashingGreen: GreenFlash(); break; case DelcomIndicatorState.FlashingRed: RedFlash(); break; case DelcomIndicatorState.FlashingBlue: BlueFlash(); break; } state = newState; } }
static void PerformIndicatorTest(IndicatorStatus indicatorStatus, DelcomIndicatorState expectedIndicatorState) { //arrange var mockLight = MockRepository.GenerateMock<IDelcomLight>(); mockLight.Expect(m => m.ChangeIndicator(expectedIndicatorState)).Repeat.Once(); var stubStatusSource = MockRepository.GenerateStub<IBuildStatusSource>(); stubStatusSource.Stub(s => s.Status).Return(indicatorStatus); var indicator = new DelcomUsbLightBuildIndicator(mockLight); //act indicator.ShowIndicator(stubStatusSource); //assert mockLight.VerifyAllExpectations(); }