예제 #1
0
        public void Test6()
        {
            string   timespan = "15";
            TimeSpan?ts       = Xmtool.DateTime().GetTimeSpanFromString(timespan);

            Assert.NotNull(ts);
            Assert.True(ts.Value.TotalSeconds == 15);
        }
예제 #2
0
 public void Test8()
 {
     try
     {
         bool bRet = Xmtool.DateTime().CheckStringTimeSpan("abc");
     }
     catch (Exception exp)
     {
         Assert.Contains("错误的时间段格式", exp.Message);
     }
 }
예제 #3
0
        public void Test2()
        {
            DateTime dtNow = DateTime.Now;
            long     ts    = Xmtool.DateTime().GetUtcTimestamp13();

            Assert.True((ts + "").Length == 13);

            DateTime dt = Xmtool.DateTime().GetLocalDateTimeFromUtcTimestamp13(ts);

            Assert.Equal(dt.Year, dtNow.Year);
            Assert.Equal(dt.Month, dtNow.Month);
            Assert.Equal(dt.Day, dtNow.Day);
            Assert.Equal(dt.Hour, dtNow.Hour);
            Assert.Equal(dt.Minute, dtNow.Minute);
            Assert.Equal(dt.Second, dtNow.Second);
        }
예제 #4
0
        public void Test7()
        {
            bool bRet = Xmtool.DateTime().CheckStringTimeSpan("1s");

            Assert.True(bRet);
        }
예제 #5
0
        public void Test9()
        {
            bool bRet = Xmtool.DateTime().CheckStringTimeSpan("abc", false);

            Assert.False(bRet);
        }