Struct ActiveTimerInfo
- Namespace
- TimeAssertions
- Assembly
- TimeAssertions.dll
An immutable description of a timer tracked by ObservableTimeProvider: the schedule it was created with, or last changed to. Used to render a deterministic "named survivor" diagnostic when a leak assertion fails, so a failure names which timer remained active by its schedule rather than reporting a bare count.
public readonly record struct ActiveTimerInfo : IEquatable<ActiveTimerInfo>
- Implements
- Inherited Members
Constructors
ActiveTimerInfo(TimeSpan, TimeSpan)
An immutable description of a timer tracked by ObservableTimeProvider: the schedule it was created with, or last changed to. Used to render a deterministic "named survivor" diagnostic when a leak assertion fails, so a failure names which timer remained active by its schedule rather than reporting a bare count.
public ActiveTimerInfo(TimeSpan DueTime, TimeSpan Period)
Parameters
DueTimeTimeSpanThe delay before the timer's first (or next) callback, as supplied to CreateTimer(TimerCallback, object, TimeSpan, TimeSpan), the most recent Change(TimeSpan, TimeSpan), or the timer's period once it has fired (a periodic timer re-arms at its period; a non-periodic one, with a period of zero or InfiniteTimeSpan, is disabled after its fire). A value of InfiniteTimeSpan indicates a timer whose callback is currently disabled.
PeriodTimeSpanThe interval between successive callbacks. A value of InfiniteTimeSpan indicates a one-shot timer that does not repeat.
Properties
DueTime
The delay before the timer's first (or next) callback, as supplied to CreateTimer(TimerCallback, object, TimeSpan, TimeSpan), the most recent Change(TimeSpan, TimeSpan), or the timer's period once it has fired (a periodic timer re-arms at its period; a non-periodic one, with a period of zero or InfiniteTimeSpan, is disabled after its fire). A value of InfiniteTimeSpan indicates a timer whose callback is currently disabled.
public TimeSpan DueTime { get; init; }
Property Value
Period
The interval between successive callbacks. A value of InfiniteTimeSpan indicates a one-shot timer that does not repeat.
public TimeSpan Period { get; init; }
Property Value
TimesFired
Gets the number of times this timer's callback has fired since it was created, as observed by
ObservableTimeProvider. Zero for a timer that has not yet fired (the default
when the value is constructed by name). With a FakeTimeProvider a fire is counted each
time test code advances fake time past the timer's due (or period) boundary.
public long TimesFired { get; init; }