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
commitd3e8485bcd1070108299995d6335318dea6a1c22 (patch)
tree99f13fac6846a3eb299bbdfa4ff6b193e4873019 /Timeline.Tests/Helpers/TestClock.cs
parent517d8023c348893221b150a8bdf04a91ee513b6b (diff)
downloadtimeline-d3e8485bcd1070108299995d6335318dea6a1c22.tar.gz
timeline-d3e8485bcd1070108299995d6335318dea6a1c22.tar.bz2
timeline-d3e8485bcd1070108299995d6335318dea6a1c22.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;
- }
- }
-}