public void MustNotDebounceCallWithDifferentValues() { var debouncer = new Debouncer <string>(_ => _counter++, 20.Milliseconds()); debouncer.DebouncedActionFor("a"); debouncer.DebouncedActionFor("b"); debouncer.DebouncedActionFor("c"); Thread.Sleep(30.Milliseconds()); Check.That(_counter).IsEqualTo(3); }
public void MustDebounceCallWithTheSameValueWhenTheDelayBetweenCallIsLowerThanDebouncerDelay() { var debouncer = new Debouncer <string>(_ => _counter++, 20.Milliseconds()); debouncer.DebouncedActionFor("a"); debouncer.DebouncedActionFor("a"); Thread.Sleep(50.Milliseconds()); Check.That(_counter).IsEqualTo(1); }