Пример #1
0
 public void EighteenOrNineteenYears()
 {
     DateDiffImprecise dateDiff = new DateDiffImprecise();
     DateTime date = new DateTime();
     date = DateTime.Parse("1997-11-8");
     int n = dateDiff.Age(date);
     Assert.IsFalse(n < 18);
     Assert.IsFalse(n > 19);
 }
Пример #2
0
 public void FiveOrSixYears()
 {
     DateDiffImprecise dateDiff = new DateSpanServer.DateDiffImprecise();
     DateTime date = new DateTime();
     date = DateTime.Parse("2010-11-8");
     int n = dateDiff.Age(date);
     Assert.IsFalse(n < 5);
     Assert.IsFalse(n > 6);
 }
Пример #3
0
        public void DateDiff()
        {
            DateDiffImprecise dateDiff = new DateDiffImprecise();
            DateTime dateA = DateTime.Parse("2003-08-12");
            DateTime dateB = DateTime.Parse("2014-12-31");
            int n = dateDiff.YearDiff(dateA, dateB);
            Assert.AreEqual(n, 11);
            n = dateDiff.YearDiff(dateB, dateA);
            Assert.AreEqual(n, -11);

            dateA = DateTime.Parse("1953-01-03");
            dateB = DateTime.Parse("2015-01-02");
            n = dateDiff.YearDiff(dateA, dateB);
            Assert.AreEqual(n, 62);

            dateA = DateTime.Parse("2015-01-01");
            dateB = DateTime.Parse("2015-01-01");
            n = dateDiff.YearDiff(dateA, dateB);
            Assert.AreEqual(n, 0);

        }
Пример #4
0
 public int GetAge(DateTime Date)
 {
     DateDiffImprecise DateDiff = new DateDiffImprecise();
     return DateDiff.Age(Date);
 }
Пример #5
0
 public int AgeDifference(DateTime DateA, DateTime DateB)
 {
     DateDiffImprecise DateDiff = new DateDiffImprecise();
     return DateDiff.YearDiff(DateA, DateB);
 }