aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Helpers/TestClock.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-06-18 17:13:08 +0800
committercrupest <crupest@outlook.com>2020-06-18 17:13:08 +0800
commit5c1b88ce2df221d6a021b9246c952dbf5ee58550 (patch)
tree953a41c4d6e1a9f967498dad83786a81b22fcce8 /Timeline.Tests/Helpers/TestClock.cs
parentddfd4cedaf696e6ad19f40bec4db0f9d0e28dc65 (diff)
downloadtimeline-5c1b88ce2df221d6a021b9246c952dbf5ee58550.tar.gz
timeline-5c1b88ce2df221d6a021b9246c952dbf5ee58550.tar.bz2
timeline-5c1b88ce2df221d6a021b9246c952dbf5ee58550.zip
feat(back): Timeline service add last modified.
Diffstat (limited to 'Timeline.Tests/Helpers/TestClock.cs')
-rw-r--r--Timeline.Tests/Helpers/TestClock.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/Timeline.Tests/Helpers/TestClock.cs b/Timeline.Tests/Helpers/TestClock.cs
index 7febc0fe..de7d0eb7 100644
--- a/Timeline.Tests/Helpers/TestClock.cs
+++ b/Timeline.Tests/Helpers/TestClock.cs
@@ -19,5 +19,25 @@ namespace Timeline.Tests.Helpers
{
_currentTime = mockTime;
}
+
+ public DateTime SetMockCurrentTime()
+ {
+ var time = new DateTime(2000, 1, 1, 1, 1, 1);
+ _currentTime = time;
+ return time;
+ }
+
+ public DateTime ForwardCurrentTime()
+ {
+ return ForwardCurrentTime(TimeSpan.FromDays(1));
+ }
+
+ public DateTime ForwardCurrentTime(TimeSpan timeSpan)
+ {
+ if (_currentTime == null)
+ return SetMockCurrentTime();
+ _currentTime.Value.Add(timeSpan);
+ return _currentTime.Value;
+ }
}
}