These xUnit examples drive interval timers under a virtual PrimeTestClock. Callbacks fire only when the test advances the clock, so the assertions are deterministic and there are no real-world wait times.
PrimeTestClockis constructed from a NodaTimeInstantso the NodaTime stack starts at a known UTC instant without timezone ambiguity.Advance(Duration)moves virtual time forward; callbacks scheduled at or before the new "now" are dispatched synchronously by the test clock beforeAdvancereturns.- A one-shot timer is requested by passing
Timeout.InfiniteTimeSpanas the repeat interval.IClockIntervalTimer.IsRepeatingisfalsefor one-shot registrations. - For repeating timers, advancing past each multiple of the repeat interval produces one callback per interval crossed.
- The async overload (
RegisterAsyncTimer) completes the awaited callback beforeAdvancereturns.
- Interval timer (production) — wall-clock counterpart in the example app.
- Test-clock control APIs —
Set*,Advance,RunFor,Start/Stop, marching, and automatic runner semantics for both stacks. - API:
IPrimeTestClock·PrimeTestClock