public void PosTest3() { System.Globalization.Calendar tc = new TaiwanCalendar(); DateTime dt = tc.MaxSupportedDateTime; Assert.Equal(365, tc.GetDayOfYear(dt)); }
public void PosTest4() { System.Globalization.Calendar tc = new TaiwanCalendar(); DateTime dt = new DateTime(2000, 12, 31); Assert.Equal(366, tc.GetDayOfYear(dt)); }
public void PosTest1() { System.Globalization.Calendar tc = new TaiwanCalendar(); Random rand = new Random(-55); int year = rand.Next(tc.MinSupportedDateTime.Year, tc.MaxSupportedDateTime.Year - 1911); int month = rand.Next(1, 12); int day; if (tc.IsLeapYear(year)) { day = rand.Next(1, _DAYS_PER_MONTHS_IN_LEAP_YEAR[month] + 1); } else { day = rand.Next(1, _DAYS_PER_MONTHS_IN_NO_LEAP_YEAR[month] + 1); } DateTime dt = new DateTime(year, month, day); int actualDay = getDayOfYear(dt); Assert.Equal(tc.GetDayOfYear(dt), actualDay); }