public void SystemDateTime_can_override_the_current_date()
        {
            var expected = new DateTime(1974, 10, 16);

            SystemDateTime.DateIs(expected);
            SystemDateTime.UtcNow.Should().Be(expected);

            SystemDateTime.Reset();
            SystemDateTime.UtcNow.Should().NotBe(expected);
        }
Beispiel #2
0
        public void should_reset_time_when_set()
        {
            var fakeNow = new DateTime(1995, 1, 1, 1, 2, 3, 4, DateTimeKind.Local);

            using (SystemDateTime.Set(fakeNow))
            {
                SystemDateTime.Reset();

                SystemDateTime.UtcNow.ShouldBeGreaterThan(fakeNow);
                SystemDateTime.Now.ShouldBeGreaterThan(fakeNow);
            }
        }
Beispiel #3
0
        public void should_reset_time_when_paused()
        {
            using (SystemDateTime.PauseTime())
            {
                var now = SystemDateTime.UtcNow;
                Thread.Sleep(50.Milliseconds());
                SystemDateTime.Reset();
                Thread.Sleep(50.Milliseconds());

                SystemDateTime.UtcNow.ShouldBeGreaterThan(now);
                SystemDateTime.Now.ShouldBeGreaterThan(now.ToLocalTime());
            }
        }
 public void TestCleanUp()
 {
     SystemDateTime.Reset();
 }
 public void Cleanup()
 {
     SystemDateTime.Reset();
 }
Beispiel #6
0
 protected override void Finally()
 {
     SystemDateTime.Reset();
 }
        public void Kill()
        {
            SystemDateTime.Reset();

            _bucket.DropAsync().GetAwaiter().GetResult();
        }
Beispiel #8
0
 public void AfterContextCleanup()
 {
     SystemDateTime.Reset();
 }
Beispiel #9
0
 public void Dispose()
 {
     SystemDateTime.Reset();
 }
Beispiel #10
0
 public void TestInitialize()
 {
     SystemDateTime.Reset();
 }