Example #1
0
        public void GetLastDateOfMonth()
        {
            Assert.AreEqual(new DateTime(2018, 1, 31), DateTimeUtility.GetLastDateOfMonth(2018, 1));
            Assert.AreEqual(new DateTime(2018, 2, 28), DateTimeUtility.GetLastDateOfMonth(2018, 2));
            Assert.AreEqual(new DateTime(2000, 2, 29), DateTimeUtility.GetLastDateOfMonth(2000, 2));

            Assert.AreEqual(new DateTime(2018, 1, 31), DateTimeUtility.GetLastDateOfMonth(new DateTime(2018, 1, 1)));
            Assert.AreEqual(new DateTime(2018, 1, 31), DateTimeUtility.GetLastDateOfMonth(new DateTime(2018, 1, 10)));
            Assert.AreEqual(new DateTime(2018, 1, 31), DateTimeUtility.GetLastDateOfMonth(new DateTime(2018, 1, 31)));
            Assert.AreEqual(new DateTime(2018, 2, 28), DateTimeUtility.GetLastDateOfMonth(new DateTime(2018, 2, 1)));
            Assert.AreEqual(new DateTime(2000, 2, 29), DateTimeUtility.GetLastDateOfMonth(new DateTime(2000, 2, 1)));
        }
Example #2
0
 public void GetLastDateOfMonth_Failed2()
 {
     Assert.AreEqual(new DateTime(2018, 1, 1), DateTimeUtility.GetLastDateOfMonth(2018, 0));
 }
Example #3
0
 public void GetLastDateOfMonth_Kind()
 {
     Assert.AreEqual(DateTimeKind.Unspecified, DateTimeUtility.GetLastDateOfMonth(new DateTime(2018, 1, 1)).Kind);
     Assert.AreEqual(DateTimeKind.Local, DateTimeUtility.GetLastDateOfMonth(new DateTime(2018, 1, 1, 0, 0, 0, DateTimeKind.Local)).Kind);
     Assert.AreEqual(DateTimeKind.Utc, DateTimeUtility.GetLastDateOfMonth(new DateTime(2018, 1, 1, 0, 0, 0, DateTimeKind.Utc)).Kind);
 }