public async Task BasicTest() { var epsilon = TimeSpan.FromSeconds(1); var epsilon10 = epsilon.Multiply(10); using var clock = new TestClock().SpeedupBy(10).OffsetBy(1000); var realStart = SystemClock.Now; var clockStart = clock.Now; ShouldEqual(realStart, DateTime.Now.ToMoment(), epsilon); ShouldEqual(realStart, clock.ToRealTime(clockStart), epsilon); ShouldEqual(clockStart, clock.ToLocalTime(realStart), epsilon10); ShouldEqual(clockStart, realStart + TimeSpan.FromSeconds(1), epsilon); await clock.Delay(TimeSpan.FromSeconds(5)); ShouldEqual(realStart + TimeSpan.FromSeconds(0.5), SystemClock.Now, epsilon); ShouldEqual(clockStart + TimeSpan.FromSeconds(5), clock.Now, epsilon10); Out.WriteLine(clock.Now.ToString()); clock.OffsetBy(1000); ShouldEqual(clockStart + TimeSpan.FromSeconds(6), clock.Now, epsilon10); clock.SpeedupBy(0.1); await clock.Delay(TimeSpan.FromSeconds(0.5)); ShouldEqual(realStart + TimeSpan.FromSeconds(1), SystemClock.Now, epsilon); ShouldEqual(clockStart + TimeSpan.FromSeconds(6.5), clock.Now, epsilon10); }