Method ToTimeProvider
ToTimeProvider(IPrimeClock)
Returns a TimeProvider that uses the given PrimeTime clock for GetUtcNow(), GetLocalNow(), and CreateTimer(TimerCallback, object, TimeSpan, TimeSpan).
public static TimeProvider ToTimeProvider(this IPrimeClock clock)
Parameters
clockIPrimeClockThe PrimeTime clock (e.g. KZDev.PrimeTime.PrimeClock or a test-clock implementation from the matching PrimeTime.Testing package).
Returns
- TimeProvider
A TimeProvider backed by
clock. Whenclockis a test clock, advancing virtual time with its Advance(TimeSpan) or RunFor(TimeSpan) operations drives the returned provider's time and timers deterministically.
Exceptions
- ArgumentNullException
clockisnull.