VirtualTimeSchedulerBase<TAbsolute, TRelative>
public abstract class VirtualTimeSchedulerBase<TAbsolute, TRelative> : IScheduler, IServiceProvider, IStopwatchProvider where TAbsolute : IComparable<TAbsolute>
Base class for virtual time schedulers.
Gets the scheduler's absolute time clock value.
Gets the comparer used to compare absolute time values.
Gets whether the scheduler is enabled to run work.
Gets the scheduler's notion of current time.
protected VirtualTimeSchedulerBase()
Creates a new virtual time scheduler with the default value of TAbsolute as the initial clock value.
Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer.
Adds a relative time value to an absolute time value.
Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
Advances the scheduler's clock to the specified time, running all work till that point.
Gets the next scheduled item to be executed.
Discovers scheduler services by interface type. The base class implementation supports
only the IStopwatchProvider service. To influence service discovery - such as adding
support for other scheduler services - derived types can override this method.
Schedules an action to be executed.
public IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
Schedules an action to be executed after dueTime.
public IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
Schedules an action to be executed at dueTime.
public abstract IDisposable ScheduleAbsolute<TState>(TState state, TAbsolute dueTime, Func<IScheduler, TState, IDisposable> action)
Schedules an action to be executed at dueTime.
public IDisposable ScheduleRelative<TState>(TState state, TRelative dueTime, Func<IScheduler, TState, IDisposable> action)
Schedules an action to be executed at dueTime.
Advances the scheduler's clock by the specified relative time.
Starts the virtual time scheduler.
Starts a new stopwatch object.
Stops the virtual time scheduler.
Converts the absolute time value to a DateTimeOffset value.
Converts the TimeSpan value to a relative time value.