Ejemplo n.º 1
0
        public void ConvertCSVDateToTimeStamp()
        {
            // Expect Result:   Student {}
            DateTime oExpectResult = DateTime.Now;
            string   szInputDate   = string.Format("2018{0}{1}{2}{3}{4}"
                                                   , FileCSVHelper.KeepInTwoDigit(oExpectResult.Month)
                                                   , FileCSVHelper.KeepInTwoDigit(oExpectResult.Day)
                                                   , FileCSVHelper.KeepInTwoDigit(oExpectResult.Hour)
                                                   , FileCSVHelper.KeepInTwoDigit(oExpectResult.Minute)
                                                   , FileCSVHelper.KeepInTwoDigit(oExpectResult.Second));

            DateTime oOutputDate = FileCSVHelper.ConvertCSVDateToTimeStamp(szInputDate);

            Assert.AreEqual(FileCSVHelper.ConvertTimeStampForCSV(oOutputDate), FileCSVHelper.ConvertTimeStampForCSV(oExpectResult));
        }
Ejemplo n.º 2
0
        public void ConvertTimeStampForCSV()
        {
            //  Expect Result: 20181231180120
            DateTime oInputDate   = DateTime.Now;
            string   szOutputDate = FileCSVHelper.ConvertTimeStampForCSV(oInputDate);
            //YYYYMMDDHHMMSS
            string szExpectResult = string.Format("2018{0}{1}{2}{3}{4}"
                                                  , FileCSVHelper.KeepInTwoDigit(oInputDate.Month)
                                                  , FileCSVHelper.KeepInTwoDigit(oInputDate.Day)
                                                  , FileCSVHelper.KeepInTwoDigit(oInputDate.Hour)
                                                  , FileCSVHelper.KeepInTwoDigit(oInputDate.Minute)
                                                  , FileCSVHelper.KeepInTwoDigit(oInputDate.Second));

            Assert.AreEqual(szOutputDate, szExpectResult);
        }