public void Sleep1() { var now = new DateTimeOffset(1983, 2, 11, 12, 0, 0, TimeSpan.Zero); var s = new HistoricalScheduler(now); s.Sleep(TimeSpan.FromDays(1)); Assert.Equal(now + TimeSpan.FromDays(1), s.Clock); }
public void Sleep2() { var s = new HistoricalScheduler(); var n = 0; s.Schedule(s.Now.AddMinutes(1), rec => { s.Sleep(TimeSpan.FromMinutes(3)); n++; rec(s.Now.AddMinutes(1)); }); s.AdvanceTo(s.Now + TimeSpan.FromMinutes(5)); Assert.Equal(2, n); }
public void Sleep_ArgumentChecking() { var s = new HistoricalScheduler(DateTimeOffset.Now); ReactiveAssert.Throws <ArgumentOutOfRangeException>(() => s.Sleep(TimeSpan.FromSeconds(-1))); }