Example #1
0
        internal void TimeNow_WithStubSystemClock_ReturnsStubbedDateTime()
        {
            // Arrange
            var stubClock = new TestClock();

            // Act
            stubClock.FreezeSetTime(StubZonedDateTime.UnixEpoch());

            // Assert
            Assert.Equal(StubZonedDateTime.UnixEpoch(), stubClock.TimeNow());
        }
Example #2
0
        internal void FreezeSetTime_WithStubSystemClockFrozenThenUnFrozen_ReturnsExpectedTimes()
        {
            // Arrange
            var stubClock = new TestClock();

            // Act
            stubClock.FreezeSetTime(StubZonedDateTime.UnixEpoch());
            var result1 = stubClock.TimeNow();

            Task.Delay(300).Wait();
            stubClock.UnfreezeTime();
            var result2 = stubClock.TimeNow();

            // Assert
            Assert.True(result1.TickOfDay < result2.TickOfDay);
        }