예제 #1
0
        public void TestClockStandardMethods()
        {
            // Arrange
            var localTimeZone        = TimeZoneInfo.Local;
            var currentUtcDateTime   = new DateTimeOffset(1968, 5, 20, 20, 2, 42, 123, TimeSpan.Zero);
            var currentLocalDateTime = TimeZoneInfo.ConvertTime(currentUtcDateTime, localTimeZone);

            // Act
            var clock = new TestClock
            {
                LocalTimeZone      = localTimeZone,
                CurrentUtcDateTime = currentUtcDateTime
            };

            // Assert
            Assert.NotNull(clock);
            Assert.Equal(currentLocalDateTime, clock.GetCurrentLocalDateTime());
            Assert.Equal(currentUtcDateTime, clock.GetCurrentUtcDateTime());
            Assert.Equal(localTimeZone, clock.GetLocalTimeZone());
        }