public static void Main() { // Creates and initializes a KoreanCalendar. KoreanCalendar myCal = new KoreanCalendar(); // Displays the header. Console.Write("YEAR\t"); for (int y = 4334; y <= 4338; y++) { Console.Write("\t{0}", y); } Console.WriteLine(); // Displays the value of the CurrentEra property. Console.Write("CurrentEra:"); for (int y = 4334; y <= 4338; y++) { Console.Write("\t{0}", myCal.GetMonthsInYear(y, KoreanCalendar.CurrentEra)); } Console.WriteLine(); // Displays the values in the Eras property. for (int i = 0; i < myCal.Eras.Length; i++) { Console.Write("Era {0}:\t", myCal.Eras[i]); for (int y = 4334; y <= 4338; y++) { Console.Write("\t{0}", myCal.GetMonthsInYear(y, myCal.Eras[i])); } Console.WriteLine(); } }
public void GetMonthsInYear(int year) { KoreanCalendar calendar = new KoreanCalendar(); int expected = new GregorianCalendar().GetMonthsInYear(year); Assert.Equal(expected, calendar.GetMonthsInYear(year + 2333)); Assert.Equal(expected, calendar.GetMonthsInYear(year + 2333, 0)); Assert.Equal(expected, calendar.GetMonthsInYear(year + 2333, 1)); }
public void PosTest3() { System.Globalization.Calendar kC = new KoreanCalendar(); System.Globalization.Calendar gC = new GregorianCalendar(); DateTime dateTime = gC.ToDateTime(2004, 2, 29, 0, 0, 0, 0); int expectedValue = gC.GetMonthsInYear(dateTime.Year, gC.GetEra(dateTime)); int actualValue; actualValue = kC.GetMonthsInYear(dateTime.Year + 2333, kC.GetEra(dateTime)); Assert.Equal(expectedValue, actualValue); }
public void PosTest2() { System.Globalization.Calendar kC = new KoreanCalendar(); System.Globalization.Calendar gC = new GregorianCalendar(); DateTime dateTime = new DateTime(DateTime.MaxValue.Ticks, DateTimeKind.Utc); int expectedValue = gC.GetMonthsInYear(dateTime.Year, gC.GetEra(dateTime)); int actualValue; actualValue = kC.GetMonthsInYear(dateTime.Year + 2333, kC.GetEra(dateTime)); Assert.Equal(expectedValue, actualValue); }
public static void Main() { // Creates and initializes a KoreanCalendar. KoreanCalendar myCal = new KoreanCalendar(); // Checks all the months in five years in the current era. int iMonthsInYear; for (int y = 4334; y <= 4338; y++) { Console.Write("{0}:\t", y); iMonthsInYear = myCal.GetMonthsInYear(y, KoreanCalendar.CurrentEra); for (int m = 1; m <= iMonthsInYear; m++) { Console.Write("\t{0}", myCal.IsLeapMonth(y, m, KoreanCalendar.CurrentEra)); } Console.WriteLine(); } }