示例#1
0
 public void PosTest1()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     Assert.NotNull(kC);
     Assert.Equal(1, kC.MinSupportedDateTime.Year);
     Assert.Equal(9999, kC.MaxSupportedDateTime.Year);
 }
 public void PosTest1()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     int expectedValue = 4362;
     int actualValue;
     actualValue = kC.TwoDigitYearMax;
     Assert.Equal(expectedValue, actualValue);
 }
 public void PosTest1()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     DateTime expectedValue = DateTime.MinValue;
     DateTime actualValue;
     actualValue = kC.MinSupportedDateTime;
     Assert.Equal(expectedValue, actualValue);
 }
示例#4
0
 public void PosTest2()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     DateTime dateTime = new GregorianCalendar().ToDateTime(9999, 12, 31, 0, 0, 0, 0);
     int expectedValue = 1;
     int actualValue;
     actualValue = kC.GetEra(dateTime);
     Assert.Equal(expectedValue, actualValue);
 }
 public void PosTest3()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     DateTime dateTime = new GregorianCalendar().ToDateTime(2008, 2, 29, 0, 0, 0, 0);
     int expectedValue = 29;
     int actualValue;
     actualValue = kC.GetDayOfMonth(dateTime);
     Assert.Equal(expectedValue, actualValue);
 }
 public void PosTest2()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     DateTime maxDT = DateTime.MaxValue;
     DateTime expectedValue = new GregorianCalendar().ToDateTime(maxDT.Year, maxDT.Month, maxDT.Day, 0, 0, 0, 0);
     DateTime actualValue;
     actualValue = kC.AddMonths(expectedValue, -2);
     Assert.Equal(kC.GetMonth(expectedValue) - 2, kC.GetMonth(actualValue));
 }
 public void NegTest2()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     DateTime actualValue;
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         actualValue = kC.AddMonths(new GregorianCalendar().ToDateTime(9999, 12, 31, 0, 0, 0, 0), 5);
     });
 }
 public void PosTest2()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     DateTime dateTime = new DateTime(DateTime.MaxValue.Ticks, DateTimeKind.Utc);
     int expectedValue = dateTime.Month;
     int actualValue;
     actualValue = kC.GetMonth(dateTime);
     Assert.Equal(expectedValue, actualValue);
 }
 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 void PosTest3()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     DateTime dateTime = new GregorianCalendar().ToDateTime(2004, 2, 29, 1, 1, 1, 0);
     DateTime expectedValue = dateTime;
     DateTime actualValue;
     actualValue = kC.ToDateTime(dateTime.Year + 2333, dateTime.Month, dateTime.Day,
         dateTime.Hour, dateTime.Minute, dateTime.Second, dateTime.Millisecond, 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 GregorianCalendar().ToDateTime(9999, 12, 31, 0, 0, 0, 0);
     int expectedValue = gC.GetDaysInMonth(dateTime.Year, dateTime.Month, gC.GetEra(dateTime));
     int actualValue;
     actualValue = kC.GetDaysInMonth(dateTime.Year + 2333, dateTime.Month, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
示例#13
0
 public void PosTest1()
 {
     DateTime dateTime = DateTime.MinValue;
     int yearAdd = _generator.GetInt16(-55) % 9999;
     DateTime expectedValue = new GregorianCalendar().ToDateTime(dateTime.Year + yearAdd, dateTime.Month, dateTime.Day, 0, 0, 0, 0);
     DateTime actualValue;
     System.Globalization.Calendar kC = new KoreanCalendar();
     actualValue = kC.AddYears(dateTime, yearAdd);
     Assert.Equal(kC.GetYear(expectedValue), kC.GetYear(actualValue));
 }
 public void NegTest2()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     int era = kC.GetEra(new DateTime());
     int actualValue;
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         actualValue = kC.GetDaysInMonth(2333, era);
     });
 }
 public void PosTest3()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = gC.ToDateTime(2008, 2, 29, 0, 0, 0, 0);
     int expectedValue = gC.GetWeekOfYear(dateTime, new CultureInfo("en-US").DateTimeFormat.CalendarWeekRule, new CultureInfo("en-US").DateTimeFormat.FirstDayOfWeek);
     int actualValue;
     actualValue = kC.GetWeekOfYear(kC.ToDateTime(dateTime.Year + 2333, dateTime.Month, dateTime.Day, 0, 0, 0, 0), new CultureInfo("ko-KR").DateTimeFormat.CalendarWeekRule, new CultureInfo("ko-KR").DateTimeFormat.FirstDayOfWeek);
     Assert.Equal(expectedValue, actualValue);
 }
示例#16
0
 public void PosTest3()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     DateTime leapDT = new GregorianCalendar().ToDateTime(2003, 1, 29, 0, 0, 0, 0);
     DateTime expectedValue = leapDT;
     DateTime actualValue;
     actualValue = kC.AddMonths(expectedValue, 1);
     Assert.Equal(kC.GetMonth(expectedValue) + 1, kC.GetMonth(actualValue));
     Assert.Equal(kC.GetDayOfMonth(expectedValue) - 1, kC.GetDayOfMonth(actualValue));
 }
示例#17
0
 public void PosTest1()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = gC.ToDateTime(1, 1, 1, 0, 0, 0, 0);
     int expectedValue = gC.GetYear(dateTime) + 2333;
     int actualValue;
     actualValue = kC.GetYear(dateTime);
     Assert.Equal(expectedValue, actualValue);
 }
示例#18
0
 public void PosTest4()
 {
     int yearAdd = TestLibrary.Generator.GetInt16(-55) % 2000 * (-1);
     DateTime dateTime = new DateTime(2000, 1, 1);
     DateTime expectedValue = new GregorianCalendar().ToDateTime(dateTime.Year + yearAdd, dateTime.Month, dateTime.Day, 0, 0, 0, 0);
     DateTime actualValue;
     System.Globalization.Calendar kC = new KoreanCalendar();
     actualValue = kC.AddYears(dateTime, yearAdd);
     Assert.Equal(kC.GetYear(expectedValue), kC.GetYear(actualValue));
 }
示例#19
0
 public void PosTest1()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     int[] eras;
     int expectedValue = 1;
     int actualValue;
     eras = kC.Eras;
     actualValue = eras[0];
     Assert.Equal(expectedValue, actualValue);
     Assert.Equal(1, eras.Length);
 }
示例#20
0
 public void NegTest1()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     int year = 2333;
     int era = 1;
     bool actualValue;
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         actualValue = kC.IsLeapYear(year, era);
     });
 }
示例#21
0
 public void PosTest5()
 {
     int yearAdd = 2;
     DateTime dateTime = new DateTime(2004, 2, 29);
     DateTime expectedValue = new GregorianCalendar().ToDateTime(dateTime.Year + yearAdd, dateTime.Month, dateTime.Day - 1, 0, 0, 0, 0);
     DateTime actualValue;
     System.Globalization.Calendar kC = new KoreanCalendar();
     actualValue = kC.AddYears(dateTime, yearAdd);
     Assert.Equal(kC.GetYear(expectedValue), kC.GetYear(actualValue));
     Assert.Equal(kC.GetDayOfMonth(expectedValue), kC.GetDayOfMonth(actualValue));
 }
 public void PosTest4()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = new DateTime(TestLibrary.Generator.GetInt64(-55) % (DateTime.MaxValue.Ticks + 1));
     dateTime = gC.ToDateTime(dateTime.Year, dateTime.Month, dateTime.Day, 0, 0, 0, 0);
     int expectedValue = gC.GetDayOfYear(dateTime);
     int actualValue;
     actualValue = kC.GetDayOfYear(dateTime);
     Assert.Equal(expectedValue, actualValue);
 }
示例#23
0
        public void PosTest4()
        {
            System.Globalization.Calendar kC = new KoreanCalendar();
            DateTime tempDT = new GregorianCalendar().ToDateTime(2006, 7, 31, 0, 0, 0, 0);
            DateTime expectedValue = tempDT;
            DateTime actualValue;
            actualValue = kC.AddMonths(expectedValue, 2);

            Assert.Equal(kC.GetMonth(expectedValue) + 2, kC.GetMonth(actualValue));
            Assert.Equal(kC.GetDayOfMonth(actualValue) + 1, kC.GetDayOfMonth(expectedValue));
        }
 public void NegTest1()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     int year = _generator.GetInt16(-55) % 2334;
     int era = kC.GetEra(new DateTime());
     int actualValue;
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         actualValue = kC.GetDaysInYear(1, era);
     });
 }
 public void PosTest4()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     DateTime dateTime = new DateTime(_generator.GetInt64(-55) % (DateTime.MaxValue.Ticks + 1));
     dateTime = new GregorianCalendar().ToDateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second, 0);
     DateTime expectedValue = dateTime;
     DateTime actualValue;
     actualValue = kC.ToDateTime(dateTime.Year + 2333, dateTime.Month, dateTime.Day,
         dateTime.Hour, dateTime.Minute, dateTime.Second, dateTime.Millisecond, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
 public void PosTest3()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = new GregorianCalendar().ToDateTime(2000, 2, 29, 0, 0, 0, 0);
     DayOfWeek expectedValue;
     DayOfWeek actualValue;
     expectedValue = gC.GetDayOfWeek(dateTime);
     actualValue = kC.GetDayOfWeek(dateTime);
     Assert.Equal(expectedValue, actualValue);
 }
示例#27
0
 public void NegTest1()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     int year = 2333;
     int month = TestLibrary.Generator.GetInt16(-55) % 12 + 1;
     int era = 1;
     bool actualValue;
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         actualValue = kC.IsLeapMonth(year, month, era);
     });
 }
示例#28
0
 public void PosTest4()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = gC.ToDateTime(1200, 2, 29, 0, 0, 0, 0);
     int year = dateTime.Year;
     int era = gC.GetEra(dateTime);
     bool expectedValue = gC.IsLeapYear(year, era);
     bool actualValue;
     actualValue = kC.IsLeapYear(year + 2333, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
 public void PosTest4()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     System.Globalization.Calendar gC = new GregorianCalendar();
     DateTime dateTime = new DateTime(_generator.GetInt64(-55) % (DateTime.MaxValue.Ticks + 1));
     dateTime = new GregorianCalendar().ToDateTime(dateTime.Year, dateTime.Month, dateTime.Day, 0, 0, 0, 0);
     int month = _generator.GetInt16(-55) % 12 + 1;
     int expectedValue = gC.GetDaysInYear(dateTime.Year, gC.GetEra(dateTime));
     int actualValue;
     actualValue = kC.GetDaysInYear(dateTime.Year + 2333, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
 public void NegTest1()
 {
     System.Globalization.Calendar kC = new KoreanCalendar();
     Int64 ticks = _generator.GetInt64(-55) % DateTime.MaxValue.Ticks + 1;
     DateTime dateTime = new DateTime(ticks);
     dateTime = kC.ToDateTime(dateTime.Year + 2333, dateTime.Month, dateTime.Day, 0, 0, 0, 0);
     int actualValue;
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         actualValue = kC.GetWeekOfYear(dateTime, (CalendarWeekRule)(-1), new CultureInfo("ko-KR").DateTimeFormat.FirstDayOfWeek);
     });
 }