mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 03:57:32 +00:00
test: Using UTC in unit tests
This commit is contained in:
parent
e99a7f313f
commit
b496594cd6
2 changed files with 5 additions and 5 deletions
|
|
@ -12,7 +12,7 @@ namespace ICD.Common.Utils.Tests.Services.Logging
|
||||||
public void TimestampTest()
|
public void TimestampTest()
|
||||||
{
|
{
|
||||||
LogItem item = new LogItem(eSeverity.Critical, null);
|
LogItem item = new LogItem(eSeverity.Critical, null);
|
||||||
DateTime time = IcdEnvironment.GetLocalTime();
|
DateTime time = IcdEnvironment.GetUtcTime();
|
||||||
|
|
||||||
Assert.IsTrue((time - item.Timestamp).TotalSeconds <= 1);
|
Assert.IsTrue((time - item.Timestamp).TotalSeconds <= 1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace ICD.Common.Utils.Tests
|
||||||
Assert.IsTrue(ThreadingUtils.Wait(() => true, 100));
|
Assert.IsTrue(ThreadingUtils.Wait(() => true, 100));
|
||||||
|
|
||||||
bool complete = false;
|
bool complete = false;
|
||||||
DateTime time = IcdEnvironment.GetLocalTime();
|
DateTime time = IcdEnvironment.GetUtcTime();
|
||||||
|
|
||||||
ThreadingUtils.SafeInvoke(() =>
|
ThreadingUtils.SafeInvoke(() =>
|
||||||
{
|
{
|
||||||
|
|
@ -22,15 +22,15 @@ namespace ICD.Common.Utils.Tests
|
||||||
});
|
});
|
||||||
|
|
||||||
Assert.IsTrue(ThreadingUtils.Wait(() => complete, 200));
|
Assert.IsTrue(ThreadingUtils.Wait(() => complete, 200));
|
||||||
Assert.AreEqual(100, (IcdEnvironment.GetLocalTime() - time).TotalMilliseconds, 20);
|
Assert.AreEqual(100, (IcdEnvironment.GetUtcTime() - time).TotalMilliseconds, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Sleep()
|
public void Sleep()
|
||||||
{
|
{
|
||||||
DateTime now = IcdEnvironment.GetLocalTime();
|
DateTime now = IcdEnvironment.GetUtcTime();
|
||||||
ThreadingUtils.Sleep(1000);
|
ThreadingUtils.Sleep(1000);
|
||||||
DateTime now2 = IcdEnvironment.GetLocalTime();
|
DateTime now2 = IcdEnvironment.GetUtcTime();
|
||||||
|
|
||||||
Assert.AreEqual(1000, (now2 - now).TotalMilliseconds, 100);
|
Assert.AreEqual(1000, (now2 - now).TotalMilliseconds, 100);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue