-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e069e8f
commit 2ffeafc
Showing
5 changed files
with
28 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace WebUI.Common.Services; | ||
|
||
public class SydneyTimeProvider : TimeProvider | ||
{ | ||
private const string Timezone = "AUS Eastern Standard Time"; | ||
|
||
private readonly TimeZoneInfo _sydneyTimeZone = TimeZoneInfo.FindSystemTimeZoneById(Timezone); | ||
|
||
public override TimeZoneInfo LocalTimeZone => _sydneyTimeZone; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using FluentAssertions; | ||
using WebUI.Common.Services; | ||
|
||
namespace UnitTests; | ||
|
||
public class SydneyTimeProviderTests | ||
{ | ||
[Fact] | ||
public void GetLocalNow_ReturnsSydneyTime() | ||
{ | ||
var sut = new SydneyTimeProvider(); | ||
var localNow = DateTimeOffset.Now; | ||
var result = sut.GetLocalNow(); | ||
result.Should().BeCloseTo(localNow, precision: TimeSpan.FromSeconds(5)); | ||
} | ||
} |
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