aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Helpers/TestClock.cs
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-08-08 17:41:59 +0800
committer杨宇千 <crupest@outlook.com>2019-08-08 17:41:59 +0800
commit6c50630c4d6576446fc2338714feaefbf28c4ed1 (patch)
tree99f13fac6846a3eb299bbdfa4ff6b193e4873019 /Timeline.Tests/Helpers/TestClock.cs
parentaa7d7d8ce33646dc63afb0c084e7daa14916646a (diff)
downloadtimeline-6c50630c4d6576446fc2338714feaefbf28c4ed1.tar.gz
timeline-6c50630c4d6576446fc2338714feaefbf28c4ed1.tar.bz2
timeline-6c50630c4d6576446fc2338714feaefbf28c4ed1.zip
Reorganize unit tests.
Diffstat (limited to 'Timeline.Tests/Helpers/TestClock.cs')
-rw-r--r--Timeline.Tests/Helpers/TestClock.cs25
1 files changed, 0 insertions, 25 deletions
diff --git a/Timeline.Tests/Helpers/TestClock.cs b/Timeline.Tests/Helpers/TestClock.cs
deleted file mode 100644
index ea90305f..00000000
--- a/Timeline.Tests/Helpers/TestClock.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using Microsoft.AspNetCore.Mvc.Testing;
-using Microsoft.Extensions.DependencyInjection;
-using System;
-using Timeline.Services;
-
-namespace Timeline.Tests.Helpers
-{
- public class TestClock : IClock
- {
- public DateTime? MockCurrentTime { get; set; } = null;
-
- public DateTime GetCurrentTime()
- {
- return MockCurrentTime.GetValueOrDefault(DateTime.Now);
- }
- }
-
- public static class TestClockWebApplicationFactoryExtensions
- {
- public static TestClock GetTestClock<T>(this WebApplicationFactory<T> factory) where T : class
- {
- return factory.Server.Host.Services.GetRequiredService<IClock>() as TestClock;
- }
- }
-}