Esempio n. 1
0
        public void TimesCommon_ToIsoExtendedString_TimePartIsOptional()
        {
            string result   = TimesCommon.ToIsoExtendedString(new DateTime(2010, 12, 25));
            string expected = "2010-12-25";

            Assert.Equal(expected, result);
        }
Esempio n. 2
0
        public void TimesCommon_ToIsoExtendedString_MightHaveTimePart()
        {
            string result   = TimesCommon.ToIsoExtendedString(new DateTime(2010, 10, 10, 23, 59, 30));
            string expected = "2010-10-10T23:59:30,0000000";

            Assert.Equal(expected, result);
        }
Esempio n. 3
0
        public void TimesCommon_ParseDateMaskRoutine_ReplacesMinusToSlashes()
        {
            TimesCommon timesCommon = new TimesCommon();
            DateTraits  dateTraits;
            var         date = timesCommon.ParseDateMaskRoutine("2010-10-20", new DateIO("%Y/%m/%d", true), out dateTraits);

            Assert.Equal(new Date(2010, 10, 20), date);
        }
Esempio n. 4
0
        public void TimesCommon_TimesShutdown_ResetCustomEpoch()
        {
            TimesCommon timesCommon = new TimesCommon();

            timesCommon.Epoch = new DateTime(2017, 10, 10);
            timesCommon.TimesShutdown();
            Assert.NotNull(timesCommon.Epoch);
        }
Esempio n. 5
0
        public void TimesCommon_ParseDateTime_ReplacesMinusToSlashes()
        {
            TimesCommon timesCommon = new TimesCommon();

            timesCommon.TimesInitialize();
            var date = timesCommon.ParseDateTime("2012-03-16 06:47:12");

            Assert.Equal(new DateTime(2012, 03, 16, 06, 47, 12), date);
        }
Esempio n. 6
0
        public void TimesCommon_ParseDate_HandlesDatesWithOrWithoutLeadingZeros()
        {
            TimesCommon timesCommon = new TimesCommon();

            timesCommon.TimesInitialize();
            Assert.Equal(new Date(2010, 1, 2), timesCommon.ParseDate("2010/01/02"));
            Assert.Equal(new Date(2010, 1, 2), timesCommon.ParseDate("2010/01/2"));
            Assert.Equal(new Date(2010, 1, 2), timesCommon.ParseDate("2010/1/02"));
            Assert.Equal(new Date(2010, 1, 2), timesCommon.ParseDate("2010/1/2"));
        }
Esempio n. 7
0
        public void TimesCommon_FormatDate_WrittenFormatGeneratesLeadingZeros()
        {
            TimesCommon timesCommon = new TimesCommon();

            timesCommon.TimesInitialize();
            Assert.Equal("2010/01/02", timesCommon.FormatDate(new Date(2010, 1, 2), FormatTypeEnum.FMT_WRITTEN));
            Assert.Equal("2010/10/02", timesCommon.FormatDate(new Date(2010, 10, 2), FormatTypeEnum.FMT_WRITTEN));
            Assert.Equal("2010/01/20", timesCommon.FormatDate(new Date(2010, 1, 20), FormatTypeEnum.FMT_WRITTEN));
            Assert.Equal("2010/10/20", timesCommon.FormatDate(new Date(2010, 10, 20), FormatTypeEnum.FMT_WRITTEN));
        }