public void NullActionIsNotAllowedForSetInterval() { Assert.Throws <ArgumentNullException>(() => { Debouncer.SetInterval(null, 10); }); }
public void SetIntervalExecutesTheGivenActionAtAGivenInterval() { // target function var counter = 0; Action inc = () => counter++; Debouncer.SetInterval(inc, 10); Assert.AreEqual(0, counter); Thread.Sleep(50); Assert.IsTrue(counter > 1); }
public void SetIntervalCanBeCancelled() { // target function var counter = 0; Action inc = () => counter++; var timer = Debouncer.SetInterval(inc, 10); Assert.AreEqual(0, counter); Thread.Sleep(50); Assert.IsTrue(counter > 1); timer.Dispose(); var lastCounter = counter; Thread.Sleep(50); Assert.AreEqual(lastCounter, counter); }
public void NullActionIsNotAllowedForSetInterval() { Debouncer.SetInterval(null, 10); }