public void OnIncreasePerformsActionWhenSet() { //arrange var increasePin = new StubPinInterface(1); var decreasePin = new StubPinInterface(2); var dial = new RotaryEncoder(increasePin, decreasePin); var called = false; dial.OnIncrease(() => called = true); //act increasePin.Spike(); //assert Assert.True(called); }
public void Run() { _redButton.OnPowerOn(() => Guess(Color.Red)); _yellowButton.OnPowerOn(() => Guess(Color.Yellow)); _greenButton.OnPowerOn(() => Guess(Color.Green)); _difficultyDial.OnIncrease(() => { if (_difficulty < 3) { _difficulty++; } StartRound(); }); _difficultyDial.OnDecrease(() => { if (_difficulty > 1) { _difficulty--; } StartRound(); }); _score = 0; _difficulty = 1; _cpuRed.TurnOnFor(TimeSpan.FromSeconds(0.5)); _cpuYellow.TurnOnFor(TimeSpan.FromSeconds(0.5)); _cpuGreen.TurnOnFor(TimeSpan.FromSeconds(0.5)); _score1.TurnOnFor(TimeSpan.FromSeconds(0.5)); _score2.TurnOnFor(TimeSpan.FromSeconds(0.5)); _score3.TurnOnFor(TimeSpan.FromSeconds(0.5)); StartRound(); }