public void GetLastDateOfQuarter() { Assert.AreEqual(new DateTime(2018, 6, 30), DateTimeUtility.GetLastDateOfQuarter(2018, 4, QuarterPeriod.First)); Assert.AreEqual(new DateTime(2018, 9, 30), DateTimeUtility.GetLastDateOfQuarter(2018, 4, QuarterPeriod.Second)); Assert.AreEqual(new DateTime(2018, 12, 31), DateTimeUtility.GetLastDateOfQuarter(2018, 4, QuarterPeriod.Third)); Assert.AreEqual(new DateTime(2019, 3, 31), DateTimeUtility.GetLastDateOfQuarter(2018, 4, QuarterPeriod.Fourth)); Assert.AreEqual(new DateTime(2018, 3, 31), DateTimeUtility.GetLastDateOfQuarter(2018, 1, QuarterPeriod.First)); Assert.AreEqual(new DateTime(2018, 6, 30), DateTimeUtility.GetLastDateOfQuarter(2018, 1, QuarterPeriod.Second)); Assert.AreEqual(new DateTime(2018, 9, 30), DateTimeUtility.GetLastDateOfQuarter(2018, 1, QuarterPeriod.Third)); Assert.AreEqual(new DateTime(2018, 12, 31), DateTimeUtility.GetLastDateOfQuarter(2018, 1, QuarterPeriod.Fourth)); Assert.AreEqual(new DateTime(2018, 3, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 1, 1), 4)); Assert.AreEqual(new DateTime(2018, 3, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 3, 31), 4)); Assert.AreEqual(new DateTime(2018, 6, 30), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 4, 1), 4)); Assert.AreEqual(new DateTime(2018, 6, 30), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 6, 30), 4)); Assert.AreEqual(new DateTime(2018, 9, 30), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 7, 1), 4)); Assert.AreEqual(new DateTime(2018, 9, 30), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 9, 30), 4)); Assert.AreEqual(new DateTime(2018, 12, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 10, 1), 4)); Assert.AreEqual(new DateTime(2018, 12, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 12, 31), 4)); Assert.AreEqual(new DateTime(1, 3, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(1, 1, 1), 4)); Assert.AreEqual(new DateTime(9999, 12, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(9999, 12, 31), 4)); Assert.AreEqual(new DateTime(2018, 1, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 1, 1), 2)); Assert.AreEqual(new DateTime(2018, 4, 30), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 3, 31), 2)); Assert.AreEqual(new DateTime(2018, 4, 30), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 4, 1), 2)); Assert.AreEqual(new DateTime(2018, 7, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 6, 30), 2)); Assert.AreEqual(new DateTime(2018, 7, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 7, 1), 2)); Assert.AreEqual(new DateTime(2018, 10, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 9, 30), 2)); Assert.AreEqual(new DateTime(2018, 10, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 10, 1), 2)); Assert.AreEqual(new DateTime(2019, 1, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 12, 31), 2)); Assert.AreEqual(new DateTime(1, 1, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(1, 1, 1), 2)); //Assert.AreEqual(new DateTime(10000, 1, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(9999, 12, 31), 2)); }
public void GetLastDateOfQuarter_Failed3() { Assert.AreEqual(DateTime.MaxValue, DateTimeUtility.GetLastDateOfQuarter(new DateTime(9999, 12, 31), 2)); }
public void GetLastDateOfQuarter_Failed2() { Assert.AreEqual(new DateTime(2018, 3, 31), DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 1, 1), 13)); }
public void GetLastDateOfQuarter_Kind() { Assert.AreEqual(DateTimeKind.Unspecified, DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 1, 1), 4).Kind); Assert.AreEqual(DateTimeKind.Local, DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 1, 1, 0, 0, 0, DateTimeKind.Local), 4).Kind); Assert.AreEqual(DateTimeKind.Utc, DateTimeUtility.GetLastDateOfQuarter(new DateTime(2018, 1, 1, 0, 0, 0, DateTimeKind.Utc), 4).Kind); }