<PackageReference Include="Polly" Version="2.2.5" />

SystemClock

public static class SystemClock
Time related delegates used to improve testability of the code
using System; using System.Threading; namespace Polly.Utilities { public static class SystemClock { public static Action<TimeSpan> Sleep = delegate(TimeSpan timespan) { new ManualResetEvent(false).WaitOne(timespan); }; public static Func<DateTime> UtcNow = () => DateTime.UtcNow; public static void Reset() { Sleep = delegate(TimeSpan timeSpan) { new ManualResetEvent(false).WaitOne(timeSpan); }; UtcNow = (() => DateTime.UtcNow); } } }