示例#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());
 }