public void UnshimedCurrentUtcTimeReturnsExpectedTime() { var wrapper = new TimeWrapper(); var now = wrapper.CurrentUtcTime; Assert.IsTrue(now - DateTime.UtcNow < new TimeSpan(0, 0, 2)); }
public void ShimedCurrentUtcTimeReturnsExpectedTime() { var wrapper = new TimeWrapper(); var expected = new DateTime(2032, 1, 1); using (ShimsContext.Create()) { System.Fakes.ShimDateTime.UtcNowGet = () => expected; var now = wrapper.CurrentUtcTime; Assert.AreEqual(expected, now); } }