Пример #1
0
        public void DateExtension_CurrentTimeZone_ReturnsTimeZoneByCode()
        {
            var timeZone = TimeZoneInfo.GetSystemTimeZones().First();

            MainApplicationContext.Current.TimeZone = timeZone;
            Assert.Equal(timeZone, DateExtension.CurrentTimeZone());
        }
Пример #2
0
 public void DateExtension_CurrentTimeZone_ReturnsContextTimeZone()
 {
     MainApplicationContext.Current.TimeZone = TimeZoneInfo.Utc;
     Assert.Equal(TimeZoneInfo.Utc, DateExtension.CurrentTimeZone());
 }
Пример #3
0
 public void DateExtension_CurrentTimeZone_ReturnsTimeZoneByCode()
 {
     MainApplicationContext.Current.TimeZoneId = "Central Standard Time";
     MainApplicationContext.Current.TimeZone   = null;
     Assert.AreEqual(TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"), DateExtension.CurrentTimeZone());
 }
Пример #4
0
 public void DateExtension_CurrentTimeZone_ReturnsLocalIfNoneSpecified()
 {
     MainApplicationContext.Current.TimeZone = null;
     Assert.Equal(TimeZoneInfo.Local, DateExtension.CurrentTimeZone());
 }
Пример #5
0
 public void DateExtension_CurrentTimeZone_ReturnsContextTimeZone()
 {
     MainApplicationContext.Current.TimeZoneId = "something that will be disregarded";
     MainApplicationContext.Current.TimeZone   = TimeZoneInfo.Utc;
     Assert.AreEqual(TimeZoneInfo.Utc, DateExtension.CurrentTimeZone());
 }