Beispiel #1
0
        public static bool CreateCalendar(string calendarName, out Calendar calendar)
        {
            calendar = null;
            bool result = false;

            if (Validator.CompareWithInvariantCulture(calendarName, "Gregorian Arabic"))
            {
                result   = true;
                calendar = new GregorianCalendar(GregorianCalendarTypes.Arabic);
            }
            else if (Validator.CompareWithInvariantCulture(calendarName, "Gregorian Middle East French"))
            {
                result   = true;
                calendar = new GregorianCalendar(GregorianCalendarTypes.MiddleEastFrench);
            }
            else if (Validator.CompareWithInvariantCulture(calendarName, "Gregorian Transliterated English"))
            {
                result   = true;
                calendar = new GregorianCalendar(GregorianCalendarTypes.TransliteratedEnglish);
            }
            else if (Validator.CompareWithInvariantCulture(calendarName, "Gregorian Transliterated French"))
            {
                result   = true;
                calendar = new GregorianCalendar(GregorianCalendarTypes.TransliteratedFrench);
            }
            else if (Validator.CompareWithInvariantCulture(calendarName, "Gregorian US English"))
            {
                result   = true;
                calendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
            }
            else if (Validator.CompareWithInvariantCulture(calendarName, "Hebrew"))
            {
                calendar = new HebrewCalendar();
            }
            else if (Validator.CompareWithInvariantCulture(calendarName, "Hijri"))
            {
                calendar = new HijriCalendar();
            }
            else if (Validator.CompareWithInvariantCulture(calendarName, "Japanese"))
            {
                calendar = new JapaneseCalendar();
            }
            else if (Validator.CompareWithInvariantCulture(calendarName, "Korea"))
            {
                calendar = new KoreanCalendar();
            }
            else if (Validator.CompareWithInvariantCulture(calendarName, "Taiwan"))
            {
                calendar = new TaiwanCalendar();
            }
            else if (Validator.CompareWithInvariantCulture(calendarName, "Thai Buddhist"))
            {
                calendar = new ThaiBuddhistCalendar();
            }
            else if (Validator.CompareWithInvariantCulture(calendarName, "Gregorian"))
            {
                calendar = new GregorianCalendar();
            }
            return(result);
        }
        public void PosTest4()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            DateTime dt = new DateTime(2000, 12, 31);

            Assert.Equal(366, tbc.GetDayOfYear(dt));
        }
        public void PosTest1()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            Random rand  = new Random(-55);
            int    year  = rand.Next(tbc.MinSupportedDateTime.Year, tbc.MaxSupportedDateTime.Year);
            int    month = rand.Next(1, 12);
            int    day;

            if (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);

            for (int i = 0; i < 7; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    int actualWeek = getWeekOfYear(dt, (CalendarWeekRule)j, (DayOfWeek)i);
                    int resultWeek = tbc.GetWeekOfYear(dt, (CalendarWeekRule)j, (DayOfWeek)i);
                    Assert.Equal(actualWeek, resultWeek);
                }
            }
        }
        public void NegTest2()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            Random rand  = new Random(-55);
            int    year  = rand.Next(tbc.MinSupportedDateTime.Year, tbc.MaxSupportedDateTime.Year);
            int    month = rand.Next(1, 12);
            int    day;

            if (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);
            CultureInfo myCI = new CultureInfo("th-TH");

            Assert.Throws <ArgumentOutOfRangeException>(() =>
            {
                tbc.GetWeekOfYear(dt, (CalendarWeekRule)3, myCI.DateTimeFormat.FirstDayOfWeek);
            });
            Assert.Throws <ArgumentOutOfRangeException>(() =>
            {
                tbc.GetWeekOfYear(dt, (CalendarWeekRule)(-1), myCI.DateTimeFormat.FirstDayOfWeek);
            });
        }
        public void PosTest1()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            int expectedMax = 2029 + 543;

            Assert.Equal(tbc.TwoDigitYearMax, expectedMax);
        }
    public static void Main()
    {
        // Creates and initializes a ThaiBuddhistCalendar.
        ThaiBuddhistCalendar myCal = new ThaiBuddhistCalendar();

        // Displays the header.
        Console.Write("YEAR\t");
        for (int y = 2544; y <= 2548; y++)
        {
            Console.Write("\t{0}", y);
        }
        Console.WriteLine();

        // Checks five years in the current era.
        Console.Write("CurrentEra:");
        for (int y = 2544; y <= 2548; y++)
        {
            Console.Write("\t{0}", myCal.IsLeapYear(y, ThaiBuddhistCalendar.CurrentEra));
        }
        Console.WriteLine();

        // Checks five years in each of the eras.
        for (int i = 0; i < myCal.Eras.Length; i++)
        {
            Console.Write("Era {0}:\t", myCal.Eras[i]);
            for (int y = 2544; y <= 2548; y++)
            {
                Console.Write("\t{0}", myCal.IsLeapYear(y, myCal.Eras[i]));
            }
            Console.WriteLine();
        }
    }
        public void PosTest3()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            DateTime dt = tbc.MaxSupportedDateTime;

            Assert.Equal(DayOfWeek.Friday, tbc.GetDayOfWeek(dt));
        }
    public void NegTest7()
    {
        System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
        Random rand        = new Random(-55);
        int    year        = rand.Next(tbc.MinSupportedDateTime.Year + 543, tbc.MaxSupportedDateTime.Year + 543);
        int    month       = rand.Next(1, 13);
        int    day         = rand.Next(1, 29);
        int    hour        = rand.Next(0, 24);
        int    minute      = rand.Next(0, 60);
        int    second      = rand.Next(0, 60);
        int    milliSecond = rand.Next(Int32.MinValue, 0);
        int    era         = tbc.Eras[0];

        Assert.Throws <ArgumentOutOfRangeException>(() =>
        {
            tbc.ToDateTime(year, month, day, hour, minute, second, milliSecond, era);
        });

        //milliSecond greater than 999;
        second = rand.Next(1000, Int32.MaxValue);
        Assert.Throws <ArgumentOutOfRangeException>(() =>
        {
            tbc.ToDateTime(year, month, day, hour, minute, second, milliSecond, era);
        });
    }
        public void PosTest1()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            Random rand  = new Random(-55);
            int    year  = rand.Next(tbc.MinSupportedDateTime.Year + 543, tbc.MaxSupportedDateTime.Year + 543);
            int    month = rand.Next(1, 13);
            int    day;

            if (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);
            }

            int hour        = rand.Next(0, 24);
            int minute      = rand.Next(0, 60);
            int second      = rand.Next(0, 60);
            int milliSecond = rand.Next(0, 1000);
            int era         = 0;

            for (int i = 0; i < tbc.Eras.Length; i++)
            {
                era = tbc.Eras[i];
                DateTime dt        = tbc.ToDateTime(year, month, day, hour, minute, second, milliSecond, era);
                DateTime desiredDT = tbc.ToDateTime(year, month, day, hour, minute, second, milliSecond);
                Assert.Equal(dt, desiredDT);
            }
        }
Beispiel #10
0
        public void NegTest5()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            Random rand  = new Random(-55);
            int    year  = rand.Next(tbc.MinSupportedDateTime.Year + 543, tbc.MaxSupportedDateTime.Year + 544);
            int    month = rand.Next(1, 13);
            int    day;

            if (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);
            }

            int hour        = rand.Next(0, 24);
            int minute      = rand.Next(Int32.MinValue, 0);
            int second      = rand.Next(0, 60);
            int milliSecond = rand.Next(0, 1000);
            int era         = tbc.Eras[0];

            Assert.Throws <ArgumentOutOfRangeException>(() =>
            {
                tbc.ToDateTime(year, month, day, hour, minute, second, milliSecond, era);
            });

            //minute greater than 59;
            minute = rand.Next(60, Int32.MaxValue);
            Assert.Throws <ArgumentOutOfRangeException>(() =>
            {
                tbc.ToDateTime(year, month, day, hour, minute, second, milliSecond, era);
            });
        }
Beispiel #11
0
        public void PosTest4()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            DateTime dt = tbc.MinSupportedDateTime;

            Assert.Equal(1, tbc.GetDayOfMonth(dt));
        }
    public static void Main()
    {
        // Creates and initializes a ThaiBuddhistCalendar.
        ThaiBuddhistCalendar myCal = new ThaiBuddhistCalendar();

        // Displays the header.
        Console.Write("YEAR\t");
        for (int y = 2544; y <= 2548; y++)
        {
            Console.Write("\t{0}", y);
        }
        Console.WriteLine();

        // Displays the value of the CurrentEra property.
        Console.Write("CurrentEra:");
        for (int y = 2544; y <= 2548; y++)
        {
            Console.Write("\t{0}", myCal.GetDaysInYear(y, ThaiBuddhistCalendar.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 = 2544; y <= 2548; y++)
            {
                Console.Write("\t{0}", myCal.GetDaysInYear(y, myCal.Eras[i]));
            }
            Console.WriteLine();
        }
    }
        public void NegTest2()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            Random rand  = new Random(-55);
            int    year  = rand.Next(tbc.MinSupportedDateTime.Year + 543, tbc.MaxSupportedDateTime.Year + 543);
            int    month = rand.Next(1, 12);
            int    day;

            if (IsLeapYear(year))
            {
                day = rand.Next(1, 30);
            }
            else
            {
                day = rand.Next(1, 29);
            }

            DateTime dt       = tbc.ToDateTime(year, month, day, 0, 0, 0, 0);
            int      addValue = rand.Next(Int32.MinValue, tbc.MinSupportedDateTime.Year - year + 543);

            Assert.Throws <ArgumentOutOfRangeException>(() =>
            {
                tbc.AddMonths(dt, addValue);
            });
        }
Beispiel #14
0
        public static void ThaiTest()
        {
            ThaiBuddhistCalendar tCal  = new ThaiBuddhistCalendar();
            DateTime             dTest = tCal.ToDateTime(2143, 1, 1, 0, 0, 0, 0);

            Assert.Equal(dTest, new DateTime(1600, 1, 1));
        }
Beispiel #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["login_person"] == null)
            {
                return;
            }
            if (Session["login_system_status_id"].ToString() == "1")
            {
                LinkButton11.Visible = true;
                LinkButton7.Visible  = true;
            }
            else
            {
                LinkButton11.Visible = false;
                LinkButton7.Visible  = false;
            }
            string Mon  = "มี.ค.";
            int    year = new ThaiBuddhistCalendar().GetYear(DateTime.Now);

            switch (DateTime.Now.Month)
            {
            case 1:
            case 2:
            case 3:
            case 10:
            case 11:
            case 12:
                Mon = "ก.ย.";
                break;
            }

            Label20.Text = "เงินเดือนก่อนเลื่อน (ณ 1 " + Mon + " " + year + " )";
        }
        public void PosTest3()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            int year = 9999 + 543;

            Assert.Equal(year, tbc.ToFourDigitYear(year));
        }
        public void PosTest2()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            Random rand = new Random(-55);
            int    year = rand.Next(tbc.GetYear(tbc.MinSupportedDateTime), tbc.GetYear(tbc.MaxSupportedDateTime));

            Assert.Equal(year, tbc.ToFourDigitYear(year));
        }
 public void IsLeapMonth(int year, int month)
 {
     ThaiBuddhistCalendar calendar = new ThaiBuddhistCalendar();
     bool expected = new GregorianCalendar().IsLeapMonth(year, month);
     Assert.Equal(expected, calendar.IsLeapMonth(year + 543, month));
     Assert.Equal(expected, calendar.IsLeapMonth(year + 543, month, 0));
     Assert.Equal(expected, calendar.IsLeapMonth(year + 543, month, 1));
 }
 public void IsLeapDay(int year, int month, int day)
 {
     ThaiBuddhistCalendar calendar = new ThaiBuddhistCalendar();
     bool expected = new GregorianCalendar().IsLeapDay(year, month, day);
     Assert.Equal(expected, new ThaiBuddhistCalendar().IsLeapDay(year + 543, month, day));
     Assert.Equal(expected, new ThaiBuddhistCalendar().IsLeapDay(year + 543, month, day, 0));
     Assert.Equal(expected, new ThaiBuddhistCalendar().IsLeapDay(year + 543, month, day, 1));
 }
 public void ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond)
 {
     ThaiBuddhistCalendar calendar = new ThaiBuddhistCalendar();
     DateTime expected = new GregorianCalendar().ToDateTime(year, month, day, hour, minute, second, millisecond);
     Assert.Equal(expected, calendar.ToDateTime(year + 543, month, day, hour, minute, second, millisecond));
     Assert.Equal(expected, calendar.ToDateTime(year + 543, month, day, hour, minute, second, millisecond, 0));
     Assert.Equal(expected, calendar.ToDateTime(year + 543, month, day, hour, minute, second, millisecond, 1));
 }
Beispiel #21
0
        public void PosTest4()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            DateTime dt = tbc.MinSupportedDateTime;
            int      i  = 0;

            VerificationHelper(dt, i);
        }
 public void IsLeapYear(int year)
 {
     ThaiBuddhistCalendar calendar = new ThaiBuddhistCalendar();
     bool expected = new GregorianCalendar().IsLeapYear(year);
     Assert.Equal(expected, calendar.IsLeapYear(year + 543));
     Assert.Equal(expected, calendar.IsLeapYear(year + 543, 0));
     Assert.Equal(expected, calendar.IsLeapYear(year + 543, 1));
 }
        public void PosTest4()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            DateTime dt  = new DateTime(2000, 2, 29);
            int      era = tbc.GetEra(dt);

            Assert.Equal(1, era);
        }
        public void PosTest3()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            DateTime dt  = tbc.MinSupportedDateTime;
            int      era = tbc.GetEra(dt);

            Assert.Equal(1, era);
        }
Beispiel #25
0
        public void PosTest1()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            System.Globalization.Calendar gc  = new GregorianCalendar();
            DateTime desiretdDT = gc.ToDateTime(1, 1, 1, 0, 0, 0, 0);

            Assert.Equal(tbc.MinSupportedDateTime, desiretdDT);
        }
Beispiel #26
0
        public void PosTest4()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            int twoYearMax = 99;

            tbc.TwoDigitYearMax = twoYearMax;
            Assert.Equal(tbc.TwoDigitYearMax, twoYearMax);
        }
 public void GetMonthsInYear(int year)
 {
     ThaiBuddhistCalendar calendar = new ThaiBuddhistCalendar();
     int expected = new GregorianCalendar().GetMonthsInYear(year);
     Assert.Equal(expected, calendar.GetMonthsInYear(year + 543));
     Assert.Equal(expected, calendar.GetMonthsInYear(year + 543, 0));
     Assert.Equal(expected, calendar.GetMonthsInYear(year + 543, 1));
 }
 public void GetDaysInMonth(int year, int month)
 {
     ThaiBuddhistCalendar calendar = new ThaiBuddhistCalendar();
     int expected = new GregorianCalendar().GetDaysInMonth(year, month);
     Assert.Equal(expected, calendar.GetDaysInMonth(year + 543, month));
     Assert.Equal(expected, calendar.GetDaysInMonth(year + 543, month, 0));
     Assert.Equal(expected, calendar.GetDaysInMonth(year + 543, month, 1));
 }
Beispiel #29
0
        public void IsLeapMonth(int year, int month)
        {
            ThaiBuddhistCalendar calendar = new ThaiBuddhistCalendar();
            bool expected = new GregorianCalendar().IsLeapMonth(year, month);

            Assert.Equal(expected, calendar.IsLeapMonth(year + 543, month));
            Assert.Equal(expected, calendar.IsLeapMonth(year + 543, month, 0));
            Assert.Equal(expected, calendar.IsLeapMonth(year + 543, month, 1));
        }
        public void GetDaysInYear(int year)
        {
            ThaiBuddhistCalendar calendar = new ThaiBuddhistCalendar();
            int expected = new GregorianCalendar().GetDaysInYear(year);

            Assert.Equal(expected, calendar.GetDaysInYear(year + 543));
            Assert.Equal(expected, calendar.GetDaysInYear(year + 543, 0));
            Assert.Equal(expected, calendar.GetDaysInYear(year + 543, 1));
        }
        public void GetDaysInMonth(int year, int month)
        {
            ThaiBuddhistCalendar calendar = new ThaiBuddhistCalendar();
            int expected = new GregorianCalendar().GetDaysInMonth(year, month);

            Assert.Equal(expected, calendar.GetDaysInMonth(year + 543, month));
            Assert.Equal(expected, calendar.GetDaysInMonth(year + 543, month, 0));
            Assert.Equal(expected, calendar.GetDaysInMonth(year + 543, month, 1));
        }
        public void IsLeapYear(int year)
        {
            ThaiBuddhistCalendar calendar = new ThaiBuddhistCalendar();
            bool expected = new GregorianCalendar().IsLeapYear(year);

            Assert.Equal(expected, calendar.IsLeapYear(year + 543));
            Assert.Equal(expected, calendar.IsLeapYear(year + 543, 0));
            Assert.Equal(expected, calendar.IsLeapYear(year + 543, 1));
        }
        public void ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond)
        {
            ThaiBuddhistCalendar calendar = new ThaiBuddhistCalendar();
            DateTime             expected = new GregorianCalendar().ToDateTime(year, month, day, hour, minute, second, millisecond);

            Assert.Equal(expected, calendar.ToDateTime(year + 543, month, day, hour, minute, second, millisecond));
            Assert.Equal(expected, calendar.ToDateTime(year + 543, month, day, hour, minute, second, millisecond, 0));
            Assert.Equal(expected, calendar.ToDateTime(year + 543, month, day, hour, minute, second, millisecond, 1));
        }
        public void PosTest4()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            tbc.TwoDigitYearMax = 2029;
            int year         = 0;
            int expectedYear = 2000;

            Assert.Equal(expectedYear, tbc.ToFourDigitYear(year));
        }
        public void IsLeapDay(int year, int month, int day)
        {
            ThaiBuddhistCalendar calendar = new ThaiBuddhistCalendar();
            bool expected = new GregorianCalendar().IsLeapDay(year, month, day);

            Assert.Equal(expected, new ThaiBuddhistCalendar().IsLeapDay(year + 543, month, day));
            Assert.Equal(expected, new ThaiBuddhistCalendar().IsLeapDay(year + 543, month, day, 0));
            Assert.Equal(expected, new ThaiBuddhistCalendar().IsLeapDay(year + 543, month, day, 1));
        }
Beispiel #36
0
        public void PosTest2()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            Random rand       = new Random(-55);
            int    twoYearMax = rand.Next(99, tbc.MaxSupportedDateTime.Year + 543);

            tbc.TwoDigitYearMax = twoYearMax;
            Assert.Equal(tbc.TwoDigitYearMax, twoYearMax);
        }
 public void ToFourDigitYear(int originalTwoYearMax, int year)
 {
     ThaiBuddhistCalendar calendar = new ThaiBuddhistCalendar();
     calendar.TwoDigitYearMax = 2029;
     if (year > 99)
     {
         Assert.Equal(year, calendar.ToFourDigitYear(year));
     }
     else if (year > 29)
     {
         Assert.Equal(year + 1900, calendar.ToFourDigitYear(year));
     }
     else
     {
         Assert.Equal(year + 2000, calendar.ToFourDigitYear(year));
     }
 }
 public void PosTest2()
 {
     System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
     int year = 9999 + 543;
     int month = 12;
     int day = 31;
     int hour = 23;
     int minute = 59;
     int second = 59;
     int milliSecond = 999;
     int era;
     for (int i = 0; i < tbc.Eras.Length; i++)
     {
         era = tbc.Eras[i];
         DateTime dt = tbc.ToDateTime(year, month, day, hour, minute, second, milliSecond);
         DateTime desireDT = new DateTime(year - 543, month, day, hour, minute, second, milliSecond);
         Assert.Equal(dt, desireDT);
     }
 }
 public void PosTest3()
 {
     System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
     DateTime minDT = tbc.MinSupportedDateTime;
     int year = 1 + 543;
     int month = 1;
     int day = 1;
     int hour = 0;
     int minute = 0;
     int second = 0;
     int milliSecond = 0;
     int era;
     for (int i = 0; i < tbc.Eras.Length; i++)
     {
         era = tbc.Eras[i];
         DateTime dt = tbc.ToDateTime(year, month, day, hour, minute, second, milliSecond);
         Assert.Equal(dt, minDT);
     }
 }
 public void PosTest1()
 {
     System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
     Random rand = new Random(-55);
     int year = rand.Next(tbc.MinSupportedDateTime.Year + 543, tbc.MaxSupportedDateTime.Year + 543);
     int month = rand.Next(1, 13);
     int day = rand.Next(1, 29);
     int hour = rand.Next(0, 24);
     int minute = rand.Next(0, 60);
     int second = rand.Next(0, 60);
     int milliSecond = rand.Next(0, 1000);
     int era = 0;
     for (int i = 0; i < tbc.Eras.Length; i++)
     {
         era = tbc.Eras[i];
         DateTime dt = tbc.ToDateTime(year, month, day, hour, minute, second, milliSecond);
         DateTime desiredDT = new DateTime(year - 543, month, day, hour, minute, second, milliSecond);
         Assert.Equal(dt, desiredDT);
     }
 }
    public void NegTest1()
    {
        System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
        Random rand = new Random(-55);
        int year = rand.Next(tbc.MaxSupportedDateTime.Year + 543, Int32.MaxValue);
        int month = rand.Next(1, 13);
        int day = rand.Next(1, 29);
        int hour = rand.Next(0, 24);
        int minute = rand.Next(0, 60);
        int second = rand.Next(0, 60);
        int milliSecond = rand.Next(0, 1000);
        int era = tbc.Eras[0];
        Assert.Throws<ArgumentOutOfRangeException>(() =>
        {
            tbc.ToDateTime(year, month, day, hour, minute, second, milliSecond, era);
        });

        year = rand.Next(Int32.MinValue, tbc.MinSupportedDateTime.Year + 543);
        Assert.Throws<ArgumentOutOfRangeException>(() =>
        {
            tbc.ToDateTime(year, month, day, hour, minute, second, milliSecond, era);
        });
    }
 public bool runTest()
   {
   Console.WriteLine(s_strTFPath + "\\" + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
   String strLoc = "Loc_000oo";
   String strValue = String.Empty;
   int iCountErrors = 0;
   int iCountTestcases = 0;
   try
     {
     DateTime dTest;
     HebrewCalendar hCal = new HebrewCalendar();
     JulianCalendar jCal = new JulianCalendar();
     HijriCalendar hiCal = new HijriCalendar ();
     GregorianCalendar gCal = new GregorianCalendar ();
     JapaneseCalendar jaCal = new JapaneseCalendar ();
     KoreanCalendar kCal = new KoreanCalendar ();
     ThaiBuddhistCalendar tCal = new ThaiBuddhistCalendar ();
     strLoc = "Loc_100vy";
     iCountTestcases++;
     dTest = new DateTime(5360,04,14,hCal); 	
     if (dTest.Year != 1600)
       {
       ++iCountErrors;	
       printerr( "Error_100aa! DateTime object was not set correctly");
       }
     if (dTest.Month != 1)
       {
       ++iCountErrors;	
       printerr( "Error_100bb! DateTime object was not set correctly");
       }
     if (dTest.Day != 1)
       {
       ++iCountErrors;	
       printerr( "Error_100cc! DateTime object was not set correctly");
       }
     if (dTest.Hour != 0)
       {
       ++iCountErrors;	
       printerr( "Error_100dd! DateTime object was not set correctly");
       }
     if (dTest.Minute != 0)
       {
       ++iCountErrors;	
       printerr( "Error_100ee! DateTime object was not set correctly");
       }
     if (dTest.Second != 0)
       {
       ++iCountErrors;	
       printerr( "Error_100ff! DateTime object was not set correctly");
       }
     if (dTest.Millisecond != 0)
       {
       ++iCountErrors;	
       printerr( "Error_100gg! DateTime object was not set correctly");
       }
     strLoc = "Loc_101vy";
     iCountTestcases++;
     dTest = new DateTime(1599,12,22,jCal); 	
     if (dTest.Year != 1600)
       {
       ++iCountErrors;	
       printerr( "Error_101aa! DateTime object was not set correctly");
       }
     if (dTest.Month != 1)
       {
       ++iCountErrors;	
       printerr( "Error_101bb! DateTime object was not set correctly");
       }
     if (dTest.Day != 1)
       {
       ++iCountErrors;	
       printerr( "Error_101cc! DateTime object was not set correctly");
       }
     if (dTest.Hour != 0)
       {
       ++iCountErrors;	
       printerr( "Error_101dd! DateTime object was not set correctly");
       }
     if (dTest.Minute != 0)
       {
       ++iCountErrors;	
       printerr( "Error_101ee! DateTime object was not set correctly");
       }
     if (dTest.Second != 0)
       {
       ++iCountErrors;	
       printerr( "Error_101ff! DateTime object was not set correctly");
       }
     if (dTest.Millisecond != 0)
       {
       ++iCountErrors;	
       printerr( "Error_101gg! DateTime object was not set correctly");
       }
     strLoc = "Loc_102vy";
     iCountTestcases++;
     dTest = new DateTime(1008,06,15,hiCal); 	
     if (dTest.Year != 1600)
       {
       ++iCountErrors;	
       printerr( "Error_102aa! DateTime object was not set correctly");
       }
     if (dTest.Month != 1)
       {
       ++iCountErrors;	
       printerr( "Error_102bb! DateTime object was not set correctly");
       }
     if (dTest.Day != 1)
       {
       ++iCountErrors;	
       printerr( "Error_102cc! DateTime object was not set correctly");
       }
     if (dTest.Hour != 0)
       {
       ++iCountErrors;	
       printerr( "Error_102dd! DateTime object was not set correctly");
       }
     if (dTest.Minute != 0)
       {
       ++iCountErrors;	
       printerr( "Error_102ee! DateTime object was not set correctly");
       }
     if (dTest.Second != 0)
       {
       ++iCountErrors;	
       printerr( "Error_102ff! DateTime object was not set correctly");
       }
     if (dTest.Millisecond != 0)
       {
       ++iCountErrors;	
       printerr( "Error_102gg! DateTime object was not set correctly");
       }
     strLoc = "Loc_103vy";
     iCountTestcases++;
     dTest = new DateTime(1600,1,1,gCal); 	
     if (dTest.Year != 1600)
       {
       ++iCountErrors;	
       printerr( "Error_103aa! DateTime object was not set correctly");
       }
     if (dTest.Month != 1)
       {
       ++iCountErrors;	
       printerr( "Error_103bb! DateTime object was not set correctly");
       }
     if (dTest.Day != 1)
       {
       ++iCountErrors;	
       printerr( "Error_103cc! DateTime object was not set correctly");
       }
     if (dTest.Hour != 0)
       {
       ++iCountErrors;	
       printerr( "Error_103dd! DateTime object was not set correctly");
       }
     if (dTest.Minute != 0)
       {
       ++iCountErrors;	
       printerr( "Error_103ee! DateTime object was not set correctly");
       }
     if (dTest.Second != 0)
       {
       ++iCountErrors;	
       printerr( "Error_103ff! DateTime object was not set correctly");
       }
     if (dTest.Millisecond != 0)
       {
       ++iCountErrors;	
       printerr( "Error_103gg! DateTime object was not set correctly");
       }
     strLoc = "Loc_104vy";
     iCountTestcases++;
     dTest = new DateTime(1,1,8,jaCal); 	
     if (dTest.Year != 1989)
       {
       ++iCountErrors;	
       printerr( "Error_104aa! DateTime object was not set correctly");
       }
     if (dTest.Month != 1)
       {
       ++iCountErrors;	
       printerr( "Error_104bb! DateTime object was not set correctly");
       }
     if (dTest.Day != 8)
       {
       ++iCountErrors;	
       printerr( "Error_104cc! DateTime object was not set correctly");
       }
     if (dTest.Hour != 0)
       {
       ++iCountErrors;	
       printerr( "Error_104dd! DateTime object was not set correctly");
       }
     if (dTest.Minute != 0)
       {
       ++iCountErrors;	
       printerr( "Error_104ee! DateTime object was not set correctly");
       }
     if (dTest.Second != 0)
       {
       ++iCountErrors;	
       printerr( "Error_104ff! DateTime object was not set correctly");
       }
     if (dTest.Millisecond != 0)
       {
       ++iCountErrors;	
       printerr( "Error_104gg! DateTime object was not set correctly");
       }
     strLoc = "Loc_105vy";
     iCountTestcases++;
     dTest = new DateTime(3933,1,1,kCal); 	
     if (dTest.Year != 1600)
       {
       ++iCountErrors;	
       printerr( "Error_105aa! DateTime object was not set correctly");
       }
     if (dTest.Month != 1)
       {
       ++iCountErrors;	
       printerr( "Error_105bb! DateTime object was not set correctly");
       }
     if (dTest.Day != 1)
       {
       ++iCountErrors;	
       printerr( "Error_105cc! DateTime object was not set correctly");
       }
     if (dTest.Hour != 0)
       {
       ++iCountErrors;	
       printerr( "Error_105dd! DateTime object was not set correctly");
       }
     if (dTest.Minute != 0)
       {
       ++iCountErrors;	
       printerr( "Error_105ee! DateTime object was not set correctly");
       }
     if (dTest.Second != 0)
       {
       ++iCountErrors;	
       printerr( "Error_105ff! DateTime object was not set correctly");
       }
     if (dTest.Millisecond != 0)
       {
       ++iCountErrors;	
       printerr( "Error_105gg! DateTime object was not set correctly");
       }
     strLoc = "Loc_106vy";
     iCountTestcases++;
     dTest = new DateTime(2143,1,1,tCal); 	
     if (dTest.Year != 1600)
       {
       ++iCountErrors;	
       printerr( "Error_106aa! DateTime object was not set correctly");
       }
     if (dTest.Month != 1)
       {
       ++iCountErrors;	
       printerr( "Error_106bb! DateTime object was not set correctly");
       }
     if (dTest.Day != 1)
       {
       ++iCountErrors;	
       printerr( "Error_106cc! DateTime object was not set correctly");
       }
     if (dTest.Hour != 0)
       {
       ++iCountErrors;	
       printerr( "Error_106dd! DateTime object was not set correctly");
       }
     if (dTest.Minute != 0)
       {
       ++iCountErrors;	
       printerr( "Error_106ee! DateTime object was not set correctly");
       }
     if (dTest.Second != 0)
       {
       ++iCountErrors;	
       printerr( "Error_106ff! DateTime object was not set correctly");
       }
     if (dTest.Millisecond != 0)
       {
       ++iCountErrors;	
       printerr( "Error_106gg! DateTime object was not set correctly");
       }
     strLoc = "Loc_524vy";
     iCountTestcases++;
     try
       {
       dTest = new DateTime(0,03,25,hCal);
       iCountErrors++;
       printerr( "Error_200bb! No exception thrown");
       }
     catch (ArgumentOutOfRangeException argexc)
       {
       printinfo( "Info_512ad! Caught ArguementOutOfRangeException");
       }
     catch (Exception e)
       {
       ++iCountErrors;	
       printerr( "Error_200aa! Wrong exception thrown: " + e.ToString());
       }
     strLoc = "Loc_333vy";
     iCountTestcases++;
     try
       {
       dTest = new DateTime(10000,03,25,hCal);
       iCountErrors++;
       printerr( "Error_300bb! No exception thrown");
       }
     catch (ArgumentOutOfRangeException argexc)
       {
       printinfo( "Info_333ad! Caught ArguementOutOfRangeException");
       }
     catch (Exception e)
       {
       ++iCountErrors;	
       printerr( "Error_300aa! Wrong exception thrown: " + e.ToString());
       }
     strLoc = "Loc_444vy";
     iCountTestcases++;
     try
       {
       dTest = new DateTime(5000,0,25,hCal);
       iCountErrors++;
       printerr( "Error_400bb! No exception thrown");
       }
     catch (ArgumentOutOfRangeException argexc)
       {
       printinfo( "Info_444ad! Caught ArguementOutOfRangeException");
       }
     catch (Exception e)
       {
       ++iCountErrors;	
       printerr( "Error_400aa! Wrong exception thrown: " + e.ToString());
       }
     strLoc = "Loc_555vy";
     iCountTestcases++;
     try
       {
       dTest = new DateTime(5000,13,25,jCal);
       iCountErrors++;
       printerr( "Error_500bb! No exception thrown");
       }
     catch (ArgumentOutOfRangeException argexc)
       {
       printinfo( "Info_555ad! Caught ArguementOutOfRangeException");
       }
     catch (Exception e)
       {
       ++iCountErrors;	
       printerr( "Error_500aa! Wrong exception thrown: " + e.ToString());
       }
     strLoc = "Loc_665vy";
     iCountTestcases++;
     try
       {
       dTest = new DateTime(2000,03,0,jCal);
       iCountErrors++;
       printerr( "Error_600bb! No exception thrown");
       }
     catch (ArgumentOutOfRangeException argexc)
       {
       printinfo( "Info_665ad! Caught ArguementOutOfRangeException");
       }
     catch (Exception e)
       {
       ++iCountErrors;	
       printerr( "Error_600aa! Wrong exception thrown: " + e.ToString());
       }
     strLoc = "Loc_777vy";
     iCountTestcases++;
     try
       {
       dTest = new DateTime(2000,03,32,jCal);
       iCountErrors++;
       printerr( "Error_700bb! No exception thrown");
       }
     catch (ArgumentOutOfRangeException argexc)
       {
       printinfo( "Info_775ad! Caught ArguementOutOfRangeException");
       }
     catch (Exception e)
       {
       ++iCountErrors;	
       printerr( "Error_700aa! Wrong exception thrown: " + e.ToString());
       }
     strLoc = "Loc_888vy";
     iCountTestcases++;
     try
       {
       dTest = new DateTime(2000,03,14,null);
       iCountErrors++;
       printerr( "Error_800bb! No exception thrown");
       }
     catch (ArgumentNullException argexc)
       {
       printinfo( "Info_885ad! Caught ArguementNullException");
       }
     catch (Exception e)
       {
       ++iCountErrors;	
       printerr( "Error_800aa! Wrong exception thrown: " + e.ToString());
       }
     } catch (Exception exc_general ) {
     ++iCountErrors;
     Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general=="+exc_general.ToString());
     }
   if ( iCountErrors == 0 )
     {
     Console.WriteLine( "paSs. "+s_strTFName+" ,iCountTestcases=="+iCountTestcases.ToString());
     return true;
     }
   else
     {
     Console.WriteLine("FAiL! "+s_strTFName+" ,iCountErrors=="+iCountErrors.ToString()+" , BugNums?: "+s_strActiveBugNums );
     return false;
     }
   }
 public void TwoDigitYearMax_Set(int newTwoDigitYearMax)
 {
     ThaiBuddhistCalendar calendar = new ThaiBuddhistCalendar();
     calendar.TwoDigitYearMax = newTwoDigitYearMax;
     Assert.Equal(newTwoDigitYearMax, calendar.TwoDigitYearMax);
 }