Пример #1
0
        public void GetDateTime_UserTZoneZero()
        {
            var resolver = new BlogTZoneResolver(string.Empty);

            var utc = new DateTime(2000, 1, 1, 0, 0, 0);
            var dt  = resolver.ToTimeZone(utc);

            Assert.IsTrue(dt == DateTime.Parse("2000/1/1 0:00:00"));
        }
Пример #2
0
        public void GetDateTime_UserTZone()
        {
            var tSpan    = "02:51:00";
            var resolver = new BlogTZoneResolver(tSpan);

            var utc = new DateTime(2000, 1, 1, 0, 0, 0);
            var dt  = resolver.ToTimeZone(utc);

            Assert.IsTrue(dt == DateTime.Parse("2000/1/1 2:51:00"));
        }
Пример #3
0
        public void InvalidTimeSpanFormat()
        {
            var resolver = new BlogTZoneResolver("996ICU");
            var utc      = new DateTime(2000, 1, 1, 0, 0, 0);

            Assert.Throws <FormatException>(() =>
            {
                resolver.ToTimeZone(utc);
            });
        }