Ejemplo n.º 1
0
        public void UnshimedCurrentUtcTimeReturnsExpectedTime()
        {
            var wrapper = new TimeWrapper();
            var now = wrapper.CurrentUtcTime;

            Assert.IsTrue(now - DateTime.UtcNow < new TimeSpan(0, 0, 2));
        }
Ejemplo n.º 2
0
 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);
     }
 }