GetDayOfMonth() public method

public GetDayOfMonth ( System.DateTime time ) : int
time System.DateTime
return int
コード例 #1
0
 public void PosTest2()
 {
     System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
     Random rand = new Random(-55);
     int year = 2000;
     int month = 2;
     int day;
     DateTime dt;
     for (day = 1; day < 30; day++)
     {
         dt = new DateTime(year, month, day);
         Assert.Equal(day, tbc.GetDayOfMonth(dt));
     }
 }
コード例 #2
0
        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 + 544);
            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 = tbc.ToDateTime(year, month, day, 0, 0, 0, 0);
            int actualDays = dt.Day;
            Assert.Equal(actualDays, tbc.GetDayOfMonth(dt));
        }
コード例 #3
0
 public void PosTest4()
 {
     System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
     DateTime dt = tbc.MinSupportedDateTime;
     Assert.Equal(1, tbc.GetDayOfMonth(dt));
 }