Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement a TimePrvider based on Qowaiv.Clock.
- Loading branch information
Showing
5 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#if NET8_0_OR_GREATER | ||
|
||
using FluentAssertions.Extensions; | ||
|
||
namespace Clock_specs; | ||
|
||
public class Time_provider | ||
{ | ||
[Test] | ||
public void reflects_time_of_Qowaiv_Clock() | ||
{ | ||
var provider = Clock.TimeProvider; | ||
|
||
using (Clock.SetTimeForCurrentContext(() => 11.June(2017).At(06, 15).AsUtc())) | ||
{ | ||
provider.GetUtcNow().Should().Be(new DateTimeOffset(2017, 06, 11, 06, 15, 00, TimeSpan.Zero)); | ||
} | ||
} | ||
|
||
[Test] | ||
public void reflects_time_zone_of_Qowaiv_Clock() | ||
{ | ||
var provider = Clock.TimeProvider; | ||
|
||
using (Clock.SetTimeZoneForCurrentContext(TestTimeZones.LeidenTime)) | ||
{ | ||
provider.LocalTimeZone.Should().Be(TestTimeZones.LeidenTime); | ||
} | ||
} | ||
|
||
[Test] | ||
public void reflects_timestamp_of_Qowaiv_Clock() | ||
{ | ||
var provider = Clock.TimeProvider; | ||
|
||
using (Clock.SetTimeForCurrentContext(() => 11.June(2017).At(06, 15).AsUtc())) | ||
{ | ||
provider.GetTimestamp().Should().Be(11.June(2017).At(06, 15).AsUtc().Ticks); | ||
} | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters