当前位置: 首页>>代码示例>>C#>>正文


C# GregorianCalendar.IsLeapDay方法代码示例

本文整理汇总了C#中System.Globalization.GregorianCalendar.IsLeapDay方法的典型用法代码示例。如果您正苦于以下问题:C# GregorianCalendar.IsLeapDay方法的具体用法?C# GregorianCalendar.IsLeapDay怎么用?C# GregorianCalendar.IsLeapDay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Globalization.GregorianCalendar的用法示例。


在下文中一共展示了GregorianCalendar.IsLeapDay方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PosTest2

 public void PosTest2()
 {
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year, month, day;
     bool expectedValue;
     bool actualValue;
     year = GetACommonYear(myCalendar);
     month = 2;
     day = 28;
     expectedValue = false;
     actualValue = myCalendar.IsLeapDay(year, month, day, 1);
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:13,代码来源:GregorianCalendarIsLeapDay.cs

示例2: PosTest3

 public void PosTest3()
 {
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year, month, day;
     bool expectedValue;
     bool actualValue;
     year = GetAYear(myCalendar);
     month = _generator.GetInt32(-55) % 12 + 1;
     day = (this.IsLeapYear(year)) ? _generator.GetInt32(-55) % s_daysInMonth366[month] + 1 : _generator.GetInt32(-55) % s_daysInMonth365[month] + 1;
     expectedValue = this.IsLeapYear(year) && 2 == month && 29 == day;
     actualValue = myCalendar.IsLeapDay(year, month, day, 1);
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:13,代码来源:GregorianCalendarIsLeapDay.cs

示例3: PosTest4

 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 month = dateTime.Month;
     int day = dateTime.Day;
     int era = gC.GetEra(dateTime);
     bool expectedValue = gC.IsLeapDay(year, month, day, era);
     bool actualValue;
     actualValue = kC.IsLeapDay(year + 2333, month, day, kC.GetEra(dateTime));
     Assert.Equal(expectedValue, actualValue);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:14,代码来源:KoreanCalendarIsLeapDay.cs

示例4: NegTest6

 public void NegTest6()
 {
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year, month, day;
     int era;
     year = this.GetAYear(myCalendar);
     month = _generator.GetInt32(-55) % 12 + 1;
     day = -1 * _generator.GetInt32(-55);
     era = _generator.GetInt32(-55) & 1;
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         myCalendar.IsLeapDay(year, month, day, era);
     });
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:14,代码来源:GregorianCalendarIsLeapDay.cs

示例5: NegTest3

 public void NegTest3()
 {
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year, month, day;
     int era;
     year = this.GetAYear(myCalendar);
     month = _generator.GetInt32(-55) % 12 + 1;
     day = (this.IsLeapYear(year)) ? _generator.GetInt32(-55) % s_daysInMonth366[month] + 1 : _generator.GetInt32(-55) % s_daysInMonth365[month] + 1;
     era = 2 + _generator.GetInt32(-55) % (int.MaxValue - 1);
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         myCalendar.IsLeapDay(year, month, day, era);
     });
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:14,代码来源:GregorianCalendarIsLeapDay.cs

示例6: NegTest2

 public void NegTest2()
 {
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year, month, day;
     year = myCalendar.MinSupportedDateTime.Year - 100;
     month = _generator.GetInt32(-55) % 12 + 1;
     day = (this.IsLeapYear(year)) ? _generator.GetInt32(-55) % s_daysInMonth366[month] + 1 : _generator.GetInt32(-55) % s_daysInMonth365[month] + 1;
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         myCalendar.IsLeapDay(year, month, day, 1);
     });
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:12,代码来源:GregorianCalendarIsLeapDay.cs

示例7: NegTest5

 public void NegTest5()
 {
     System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
     int year, month, day;
     int era;
     year = this.GetAYear(myCalendar);
     month = 13 + TestLibrary.Generator.GetInt32(-55) % (int.MaxValue - 12);
     day = 1;
     era = TestLibrary.Generator.GetInt32(-55) & 1;
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         myCalendar.IsLeapDay(year, month, day, era);
     });
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:14,代码来源:GregorianCalendarIsLeapDay.cs


注:本文中的System.Globalization.GregorianCalendar.IsLeapDay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。