public void TestConstructFromDayOfYear()
        {
            int[] years = { 2000, 2001 };

            Assert.IsTrue(YearMonthDay.IsLeapYear(years[0]));
            Assert.IsFalse(YearMonthDay.IsLeapYear(years[1]));

            foreach (int year in years)
            {
                int cumulativeDays = 0;
                for (int month = 1; month <= 12; ++month)
                {
                    // Test first of the month.
                    YearMonthDay ymd = new YearMonthDay(year, cumulativeDays + 1);
                    Assert.AreEqual(year, ymd.Year);
                    Assert.AreEqual(month, ymd.Month);
                    Assert.AreEqual(1, ymd.Day);

                    int daysInMonth = YearMonthDay.DaysInMonth(year, month);

                    // Test last of the month.
                    ymd = new YearMonthDay(year, cumulativeDays + daysInMonth);
                    Assert.AreEqual(year, ymd.Year);
                    Assert.AreEqual(month, ymd.Month);
                    Assert.AreEqual(daysInMonth, ymd.Day);

                    cumulativeDays += daysInMonth;
                }
            }
        }
 public void TestIsLeapYear()
 {
     for (int i = 1; i < 10000; ++i)
     {
         if ((i % 4 == 0) && !((i % 100 == 0) && (i % 400 != 0)))
         {
             Assert.IsTrue(YearMonthDay.IsLeapYear(i));
         }
     }
 }