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
commit1eb71943ad8d4769cb6166a6f33c0eecea80fffe (patch)
tree142b75bedde3afb46570c11c39614a2cdf4c2584 /Timeline.Tests/Helpers/TestClock.cs
parent3e471ac783d91fcc61a90b759fecefe3b80014ba (diff)
downloadtimeline-1eb71943ad8d4769cb6166a6f33c0eecea80fffe.tar.gz
timeline-1eb71943ad8d4769cb6166a6f33c0eecea80fffe.tar.bz2
timeline-1eb71943ad8d4769cb6166a6f33c0eecea80fffe.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;
+ }
}
}