Table of Contents

Interface IPrimeTestClock

Namespace
KZDev.PrimeTime.Testing
Assembly
KZDev.PrimeTime.Testing.dll

NodaTime-specific test clock members: SetInstant(Instant), SetLocalTime(LocalDateTime), and NodaTime.Duration-based Advance(Duration), RunFor(Duration), and Start(Duration?) overloads.

public interface IPrimeTestClock : IPrimeTestTime, IPrimeClock, IPrimeTime
Inherited Members

Remarks

Semantics match the shared BCL IPrimeTestClock surface after conversion: forward setters march, backward rules apply after resolving to UTC, run-rate bounds match Start(TimeSpan?), and the automatic runner shares the same deadline-driven behavior documented there.

Methods

Advance(Duration)

Advances the clock's virtual time by the specified duration. Pending delays (Sleep, DelayAsync) that are due by the new time complete, time-based cancellation tokens that expire by the new time are cancelled, and any interval or day-time timers that are due are invoked.

Advance(TimeSpan)

Advances virtual time forward by marching to each earliest due instant up to the new horizon, then dispatching delays, time expiries, and timers at each step.

RunFor(Duration)

Starts a bounded automatic run that advances virtual time by duration at a 1:1 real-time pace (one second of virtual time per real second), then stops when that virtual elapsed time is reached.

RunFor(Duration, Duration)

Starts a bounded automatic run that advances virtual time by duration at perSecondRate (virtual time per one real second), then stops when that virtual elapsed time is reached.

RunFor(TimeSpan)

Starts a bounded automatic run that advances virtual time by duration at a 1:1 real-time pace (one second of virtual time per real second), then stops when that virtual elapsed time is reached.

RunFor(TimeSpan, TimeSpan)

Starts a bounded automatic run that advances virtual time by duration at perSecondRate (virtual time per one real second), then stops when that virtual elapsed time is reached.

SetInstant(Instant)

Sets the current UTC instant, using forward marching when instant is strictly after the current virtual time.

SetLocalTime(LocalDateTime)

Sets virtual time from a local wall-clock value in the clock's zone, using forward marching when the resolved instant is strictly after the current virtual time.

SetTime(DateTimeOffset)

Sets the current UTC time of the clock to the specified value. When the clock is not running, this is the time returned by UtcNowDateTimeOffset and related members.

Start(Duration?)

Starts the deadline-driven automatic runner at the given virtual-time-per-real-second rate.

Start(TimeSpan?)

Starts a background runner that advances virtual time toward the next delay, time-expiry, timer due instant, or virtual-minute ClockEvents heartbeat, scaled by the run rate.

Stop()

Stops the automatic runner and clears the monotonic run anchor.

Events

ClockEvents

Occurs when the clock publishes a discriminated lifecycle or virtual-time event.