TestClock class
Namespace: Arlecchino.Testing · Assembly: Arlecchino.Testing
A clock a test moves by hand. Scheduled work runs when the clock passes its due time, so a second is moved rather than waited for.
public sealed class TestClock : TimeProvider
Inherits from TimeProvider
Constructors
| Member | Summary |
|---|---|
TestClock() |
Methods
| Member | Summary |
|---|---|
Advance(TimeSpan) | Moves the clock forward. |
GetUtcNow() | The time the clock reads now. |
Constructors in detail
TestClock()
public TestClock();
Methods in detail
Advance(TimeSpan)
public void Advance(TimeSpan amount);
Moves the clock forward.
Parameters
| Name | Type | Description |
|---|---|---|
amount | TimeSpan | How far ahead; a negative amount leaves the clock where it is. |
GetUtcNow()
public override DateTimeOffset GetUtcNow();
The time the clock reads now.
Returns DateTimeOffset — The current time.