private void FakeVerifyAnalogWrite(int value) { foreach (var pin in Pins) { var p = pin; A.CallTo(() => _arduino.AnalogWrite(p, value)).MustHaveHappened(Repeated.Exactly.Once); } }
public void Fade_with_high_value_should_fadeIn() { var times = 0; const int toIntensity = 255; A.CallTo(() => _arduino.AnalogWrite(Pin, A <int> ._)) .Invokes(() => { times++; }); _led.Fade(toIntensity); for (var i = 0; i < toIntensity - 1; i++) { _timer.Tick(); } _led.Intensity.ShouldEqual(toIntensity); times.ShouldEqual(255); }