private void PollFileForChanges(string filename, Action onChanged) { var fileTimestamp = DateTime.MinValue; _tim.Start(() => { if (_fs.FileHasChanged(filename, ref fileTimestamp)) { onChanged(); } }); _tim.Wait(); }
public void Blocks_while_notification_is_handled() { var sut = new BlockingTimer(50); var i = 0; sut.Start(() => { i++; Thread.Sleep(200); sut.Stop(); }); sut.Wait(); Assert.AreEqual(1, i); }
public void Fires_regularly() { var sut = new BlockingTimer(50); var i = 0; sut.Start(() => { i++; if (i == 3) { sut.Stop(); } }); sut.Wait(); Assert.AreEqual(3, i); }