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 era; int actualDays; if (tc.IsLeapYear(year)) { actualDays = 366; } else { actualDays = 365; } for (int i = 0; i < tc.Eras.Length; i++) { era = tc.Eras[i]; Assert.Equal(tc.GetDaysInYear(year, era), actualDays); } }
public void PosTest3() { System.Globalization.Calendar tc = new TaiwanCalendar(); DateTime dt = tc.MaxSupportedDateTime; int year = dt.Year - 1911; int era; int actualDays; if (tc.IsLeapYear(year)) { actualDays = 366; } else { actualDays = 365; } for (int i = 0; i < tc.Eras.Length; i++) { era = tc.Eras[i]; Assert.Equal(tc.GetDaysInYear(year, era), actualDays); } }
public void NegTest2() { System.Globalization.Calendar tc = new TaiwanCalendar(); Random rand = new Random(-55); int year = tc.MinSupportedDateTime.Year - rand.Next(1, Int32.MaxValue); int era = Calendar.CurrentEra; Assert.Throws<ArgumentOutOfRangeException>(() => { tc.GetDaysInYear(year, era); }); }