示例#1
0
        public void CanParseToServerTimeZoneFromStandardUser()
        {
            var service = new ServerTime();

            var parsedTimeBeforeSaving = service.ParseToServerTimeZoneFromStandardUser("2014-02-22 01:24 PM", "yyyy-MM-dd hh:mm tt");

            Assert.AreEqual(12, parsedTimeBeforeSaving.Hour);
            Assert.AreEqual(24, parsedTimeBeforeSaving.Minute);

            var parsedTimeInSaving = service.ParseToServerTimeZoneFromStandardUser("2014-09-22 01:24 PM", "yyyy-MM-dd hh:mm tt");

            Assert.AreEqual(11, parsedTimeInSaving.Hour);
            Assert.AreEqual(24, parsedTimeInSaving.Minute);

            var parsedTimeAfterSaving = service.ParseToServerTimeZoneFromStandardUser("2014-12-22 01:24 PM", "yyyy-MM-dd hh:mm tt");

            Assert.AreEqual(12, parsedTimeAfterSaving.Hour);
            Assert.AreEqual(24, parsedTimeAfterSaving.Minute);

            var parsedTimeBreakingPOint = service.ParseToServerTimeZoneFromStandardUser("2013-10-01 10:27 AM", "yyyy-MM-dd hh:mm tt");

            Assert.AreEqual(8, parsedTimeBreakingPOint.Hour);
            Assert.AreEqual(27, parsedTimeBreakingPOint.Minute);
        }