public async Task TestStopAndResume() { ResumableTimer rt = new ResumableTimer(TimeoutCallback, 2); rt.Start(TimeSpan.FromMilliseconds(150)); await Task.Delay(10); Assert.AreEqual(this.timeoutData, 1); rt.Stop(); rt.Resume(); await Task.Delay(10); Assert.AreEqual(this.timeoutData, 1, "How long did stop/resume take?"); rt.Stop(); await Task.Delay(250); Assert.AreEqual(this.timeoutData, 1, "Ensure that Stop/Resume work without timeout"); rt.Resume(); await Task.Delay(10); Assert.AreEqual(this.timeoutData, 2, "Ensure that Resume worked"); }