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


C# ZoneYearOffset.GetOccurrenceForYear方法代码示例

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


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

示例1: GetOccurrenceForYear_Defaults_Epoch

 public void GetOccurrenceForYear_Defaults_Epoch()
 {
     var offset = new ZoneYearOffset(TransitionMode.Utc, 1, 1, 0, true, LocalTime.Midnight);
     var actual = offset.GetOccurrenceForYear(1970);
     var expected = new LocalDateTime(1970, 1, 1, 0, 0).ToLocalInstant();
     Assert.AreEqual(expected, actual);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:ZoneYearOffsetTest.cs

示例2: GetOccurrenceForYear_Milliseconds

 public void GetOccurrenceForYear_Milliseconds()
 {
     var offset = new ZoneYearOffset(TransitionMode.Utc, 1, 1, 0, true, new LocalTime(0, 0, 0, 1));
     var actual = offset.GetOccurrenceForYear(1970);
     var expected = new LocalDateTime(1970, 1, 1, 0, 0, 0, 1).ToLocalInstant();
     Assert.AreEqual(expected, actual);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:ZoneYearOffsetTest.cs

示例3: GetOccurrenceForYear_WithAddDay

 public void GetOccurrenceForYear_WithAddDay()
 {
     // Last Thursday in October, then add 24 hours. The last Thursday in October 2013 is the 31st, so
     // we should get the start of November 1st.
     var offset = new ZoneYearOffset(TransitionMode.Utc, 10, -1, (int) IsoDayOfWeek.Thursday, false, LocalTime.Midnight, true);
     var actual = offset.GetOccurrenceForYear(2013);
     var expected = new LocalDateTime(2013, 11, 1, 0, 0).ToLocalInstant();
     Assert.AreEqual(expected, actual);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:9,代码来源:ZoneYearOffsetTest.cs

示例4: GetOccurrenceForYear_WithAddDay_December31st9999

 public void GetOccurrenceForYear_WithAddDay_December31st9999()
 {
     var offset = new ZoneYearOffset(TransitionMode.Utc, 12, 31, 0, false, LocalTime.Midnight, true);
     var actual = offset.GetOccurrenceForYear(9999);
     var expected = LocalInstant.AfterMaxValue;
     Assert.AreEqual(expected, actual);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:ZoneYearOffsetTest.cs

示例5: GetOccurrenceForYear_AtLeastFeb29th_NotLeapYear

 public void GetOccurrenceForYear_AtLeastFeb29th_NotLeapYear()
 {
     ZoneYearOffset offset = new ZoneYearOffset(TransitionMode.Utc, 2, 29, (int) IsoDayOfWeek.Sunday, true, LocalTime.Midnight);
     Assert.Throws<InvalidOperationException>(() => offset.GetOccurrenceForYear(2013));
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:5,代码来源:ZoneYearOffsetTest.cs

示例6: GetOccurrenceForYear_AtMostFeb29th_NotLeapYear

 public void GetOccurrenceForYear_AtMostFeb29th_NotLeapYear()
 {
     ZoneYearOffset offset = new ZoneYearOffset(TransitionMode.Utc, 2, 29, (int) IsoDayOfWeek.Sunday, false, LocalTime.Midnight);
     var actual = offset.GetOccurrenceForYear(2013);
     var expected = new LocalDateTime(2013, 2, 24, 0, 0).ToLocalInstant(); // Feb 24th is the last Sunday is February 2013
     Assert.AreEqual(expected, actual);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:ZoneYearOffsetTest.cs

示例7: GetOccurrenceForYear_AtLeastFeb29th_LeapYear

 public void GetOccurrenceForYear_AtLeastFeb29th_LeapYear()
 {
     ZoneYearOffset offset = new ZoneYearOffset(TransitionMode.Utc, 2, 29, (int) IsoDayOfWeek.Sunday, true, LocalTime.Midnight);
     var actual = offset.GetOccurrenceForYear(2012);
     var expected = new LocalDateTime(2012, 3, 4, 0, 0).ToLocalInstant(); // March 4th is the first Sunday after 2012-02-29
     Assert.AreEqual(expected, actual);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:ZoneYearOffsetTest.cs

示例8: GetOccurrenceForYear_ExactlyFeb29th_NotLeapYear

 public void GetOccurrenceForYear_ExactlyFeb29th_NotLeapYear()
 {
     ZoneYearOffset offset = new ZoneYearOffset(TransitionMode.Utc, 2, 29, 0, false, LocalTime.Midnight);
     Assert.Throws<InvalidOperationException>(() => offset.GetOccurrenceForYear(2013));
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:5,代码来源:ZoneYearOffsetTest.cs

示例9: GetOccurrenceForYear_ExactlyFeb29th_LeapYear

 public void GetOccurrenceForYear_ExactlyFeb29th_LeapYear()
 {
     ZoneYearOffset offset = new ZoneYearOffset(TransitionMode.Utc, 2, 29, 0, false, LocalTime.Midnight);
     var actual = offset.GetOccurrenceForYear(2012);
     var expected = new LocalDateTime(2012, 2, 29, 0, 0).ToLocalInstant();
     Assert.AreEqual(expected, actual);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:ZoneYearOffsetTest.cs

示例10: GetOccurrenceForYear_LastSundayInOctober

 public void GetOccurrenceForYear_LastSundayInOctober()
 {
     ZoneYearOffset offset = new ZoneYearOffset(TransitionMode.Utc, 10, -1, (int)IsoDayOfWeek.Sunday, false, LocalTime.Midnight);
     var actual = offset.GetOccurrenceForYear(1996);
     var expected = new LocalDateTime(1996, 10, 27, 0, 0).ToLocalInstant();
     Assert.AreEqual(expected, actual);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:ZoneYearOffsetTest.cs

示例11: GetOccurrenceForYear_WednesdayBackward

 public void GetOccurrenceForYear_WednesdayBackward()
 {
     var offset = new ZoneYearOffset(TransitionMode.Utc, 1, 15, (int)DayOfWeek.Wednesday, false, LocalTime.Midnight);
     var actual = offset.GetOccurrenceForYear(1970);
     var expected = new LocalDateTime(1970, 1, 14, 0, 0).ToLocalInstant(); // 1970-01-15 was a Thursday
     Assert.AreEqual(expected, actual);
 }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:ZoneYearOffsetTest.cs


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