<PackageReference Include="ReactiveUI.Primitives" Version="7.5.0" />

ReactiveUI.Primitives.Concurrency.VirtualTimeSequencer<TAbsolute, TRelative>

public sealed class VirtualTimeSequencer<TAbsolute, TRelative> : ISequencer, IServiceProvider, IStopwatchProvider where TAbsolute : IComparable<TAbsolute>
Runs scheduled work against a controllable clock using the supplied time arithmetic.
public TAbsolute Clock { get; }

Gets the scheduler's absolute time clock value.

public bool IsEnabled { get; }

Gets a value indicating whether the scheduler is enabled to run work.

public DateTimeOffset Now { get; }

public long Timestamp { get; }

public VirtualTimeSequencer(TAbsolute initialClock, IComparer<TAbsolute> comparer, Func<TAbsolute, TRelative, TAbsolute> add, Func<TAbsolute, DateTimeOffset> toDateTimeOffset, Func<TimeSpan, TRelative> toRelative)

Initializes a new instance of the VirtualTimeSequencer<T, U> class.

public void AdvanceBy(TRelative time)

Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.

public void AdvanceTo(TAbsolute time)

Advances the scheduler's clock to the specified time, running all work till that point.

public void Schedule(IWorkItem item)

public void Schedule(IWorkItem item, long dueTimestamp)

public IDisposable Schedule<TState>(TState state, Func<ISequencer, TState, IDisposable> action)

Schedules an action to be executed at the current clock.

public IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<ISequencer, TState, IDisposable> action)

Schedules an action to be executed after a relative due time.

public IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<ISequencer, TState, IDisposable> action)

Schedules an action to be executed at an absolute date-time.

public IDisposable ScheduleAbsolute<TState>(TState state, TAbsolute dueTime, Func<ISequencer, TState, IDisposable> action)

Schedules an action to be executed at an absolute due time.

public IDisposable ScheduleRelative<TState>(TState state, TRelative dueTime, Func<ISequencer, TState, IDisposable> action)

Schedules an action to be executed after a relative due time.

public void Sleep(TRelative time)

Advances the scheduler's clock by the specified relative time without running work.

public void Start()

Starts the virtual time scheduler.

public IStopwatch StartStopwatch()

Starts a new stopwatch object.

public void Stop()

Stops the virtual time scheduler.