Пример #1
0
        public void GetFirstDateOfFiscalYear()
        {
            Assert.AreEqual(new DateTime(2017, 4, 1), DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(2018, 1, 1), 4));
            Assert.AreEqual(new DateTime(2018, 4, 1), DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(2018, 4, 1), 4));
            Assert.AreEqual(new DateTime(2018, 4, 1), DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(2018, 12, 31), 4));
            Assert.AreEqual(new DateTime(1, 4, 1), DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(1, 4, 1), 4));
            Assert.AreEqual(new DateTime(9999, 4, 1), DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(9999, 12, 31), 4));

            Assert.AreEqual(new DateTime(2018, 1, 1), DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(2018, 1, 1), 1));
            Assert.AreEqual(new DateTime(2018, 1, 1), DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(2018, 4, 1), 1));
            Assert.AreEqual(new DateTime(2018, 1, 1), DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(2018, 12, 31), 1));
            Assert.AreEqual(new DateTime(1, 1, 1), DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(1, 1, 1), 1));
            Assert.AreEqual(new DateTime(1, 1, 1), DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(1, 4, 1), 1));
            Assert.AreEqual(new DateTime(9999, 1, 1), DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(9999, 12, 31), 1));
        }
Пример #2
0
 public void GetFirstDateOfFiscalYear_Kind()
 {
     Assert.AreEqual(DateTimeKind.Unspecified, DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(2018, 1, 1), 4).Kind);
     Assert.AreEqual(DateTimeKind.Local, DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(2018, 1, 1, 0, 0, 0, DateTimeKind.Local), 4).Kind);
     Assert.AreEqual(DateTimeKind.Utc, DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(2018, 1, 1, 0, 0, 0, DateTimeKind.Utc), 4).Kind);
 }
Пример #3
0
 public void GetFirstDateOfFiscalYear_Failed3()
 {
     Assert.AreEqual(DateTime.MinValue, DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(1, 1, 1), 4));
 }
Пример #4
0
 public void GetFirstDateOfFiscalYear_Failed2()
 {
     Assert.AreEqual(new DateTime(2017, 4, 1), DateTimeUtility.GetFirstDateOfFiscalYear(new DateTime(2018, 1, 1), 13));
 }