[This is preliminary documentation and is subject to change.]
Clock which can be constructed with an initial instant, and then advanced programmatically (and optionally,
automatically advanced on each read).
This class is designed to be used when testing classes which take an IClock as a dependency.


All Members | Constructors | Methods | Properties | ||
Icon | Member | Description |
---|---|---|
![]() | FakeClock(Instant) |
Creates a fake clock initially set to the given instant, with no auto-advance.
|
![]() | FakeClock(Instant, Duration) |
Creates a fake clock initially set to the given instant. The clock will advance by the given duration on
each read.
|
![]() | Advance(Duration) |
Advances the clock by the given duration.
|
![]() | AdvanceDays(Int64) |
Advances the clock by the given number of standard (24-hour) days.
|
![]() | AdvanceHours(Int64) |
Advances the clock by the given number of hours.
|
![]() | AdvanceMilliseconds(Int64) |
Advances the clock by the given number of milliseconds.
|
![]() | AdvanceMinutes(Int64) |
Advances the clock by the given number of minutes.
|
![]() | AdvanceSeconds(Int64) |
Advances the clock by the given number of seconds.
|
![]() | AdvanceTicks(Int64) |
Advances the clock by the given number of ticks.
|
![]() | AutoAdvance |
Amount of time to advance the clock by on each call to read the current time.
|
![]() ![]() | FromUtc(Int32, Int32, Int32) |
Returns a fake clock initially set to midnight of the given year/month/day in UTC in the ISO calendar.
The value of the AutoAdvance property will be initialised to zero.
|
![]() ![]() | FromUtc(Int32, Int32, Int32, Int32, Int32, Int32) |
Returns a fake clock initially set to the given year/month/day/time in UTC in the ISO calendar.
The value of the AutoAdvance property will be initialised to zero.
|
![]() | Now |
Returns the "current time" for this clock. Unlike a normal clock, this
property may return the same value from repeated calls until one of the methods
to change the time is called.
|
![]() | Reset(Instant) |
Resets the clock to the given instant.
The value of the AutoAdvance property will be unchanged.
|

This class is somewhere between a fake and a stub, depending on how it's used - if it's set to
AutoAdvance then time will pass, but in a pretty odd way (i.e. dependent on how
often it's consulted).

This type is thread-safe, primarily in order to allow IClock to be documented as
"thread safe in all built-in implementations".

Object | |
![]() | FakeClock |
Assembly: NodaTime.Testing (Module: NodaTime.Testing.dll) Version: 1.2.0.0 (1.2.0)