public void Test6() { string timespan = "15"; TimeSpan?ts = Xmtool.DateTime().GetTimeSpanFromString(timespan); Assert.NotNull(ts); Assert.True(ts.Value.TotalSeconds == 15); }
public void Test8() { try { bool bRet = Xmtool.DateTime().CheckStringTimeSpan("abc"); } catch (Exception exp) { Assert.Contains("错误的时间段格式", exp.Message); } }
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); }
public void Test7() { bool bRet = Xmtool.DateTime().CheckStringTimeSpan("1s"); Assert.True(bRet); }
public void Test9() { bool bRet = Xmtool.DateTime().CheckStringTimeSpan("abc", false); Assert.False(bRet); }