• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ZoneYearOffset类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ZoneRuleSet

 internal ZoneRuleSet(List<ZoneRecurrence> rules, Offset standardOffset, int upperYear, ZoneYearOffset upperYearOffset)
 {
     this.rules = rules;
     this.StandardOffset = standardOffset;
     this.upperYear = upperYear;
     this.upperYearOffset = upperYearOffset;
 }
开发者ID:nicklbailey,项目名称:nodatime,代码行数:7,代码来源:ZoneRuleSet.cs


示例2: 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


示例3: Next_FirstYear

 public void Next_FirstYear()
 {
     var januaryFirstMidnight = new ZoneYearOffset(TransitionMode.Utc, 1, 1, 0, true, Offset.Zero);
     var recurrence = new ZoneRecurrence("bob", Offset.Zero, januaryFirstMidnight, 1970, 1972);
     Transition? actual = recurrence.Next(Instant.UnixEpoch, Offset.Zero, Offset.Zero);
     Transition? expected = new Transition(new Instant(Instant.UnixEpoch.Ticks + (1 * TicksPerStandardYear)), Offset.Zero, Offset.Zero);
     Assert.AreEqual(expected, actual);
 }
开发者ID:manirana007,项目名称:NodaTime,代码行数:8,代码来源:ZoneRecurrenceTest.cs


示例4: PreviousOrSame_LastYear

 public void PreviousOrSame_LastYear()
 {
     var januaryFirstMidnight = new ZoneYearOffset(TransitionMode.Utc, 1, 1, 0, true, LocalTime.Midnight);
     var recurrence = new ZoneRecurrence("bob", Offset.Zero, januaryFirstMidnight, 1970, 1972);
     Transition? actual = recurrence.PreviousOrSame(Instant.FromUtc(1971, 1, 1, 0, 0) - Duration.Epsilon, Offset.Zero, Offset.Zero);
     Transition? expected = new Transition(NodaConstants.UnixEpoch, Offset.Zero);
     Assert.AreEqual(expected, actual);
 }
开发者ID:ivandrofly,项目名称:nodatime,代码行数:8,代码来源:ZoneRecurrenceTest.cs


示例5: WriteRead

 public void WriteRead()
 {
     var yearOffset = new ZoneYearOffset(TransitionMode.Utc, 10, 31, (int)IsoDayOfWeek.Wednesday, true, Offset.Zero);
     var recurrence = new ZoneRecurrence("bob", Offset.Zero, yearOffset, 1971, 2009);
     var actual = new ZoneRule(recurrence, "D");
     var expected = new ZoneRule(recurrence, "D");
     Assert.AreEqual(expected, actual);
 }
开发者ID:manirana007,项目名称:NodaTime,代码行数:8,代码来源:ZoneRuleTest.cs


示例6: Next_BeforeFirstYear

 public void Next_BeforeFirstYear()
 {
     var januaryFirstMidnight = new ZoneYearOffset(TransitionMode.Utc, 1, 1, 0, true, LocalTime.Midnight);
     var recurrence = new ZoneRecurrence("bob", Offset.Zero, januaryFirstMidnight, 1970, 1972);
     Transition? actual = recurrence.Next(Instant.MinValue, Offset.Zero, Offset.Zero);
     Transition? expected = new Transition(NodaConstants.UnixEpoch, Offset.Zero);
     Assert.AreEqual(expected, actual);
 }
开发者ID:ivandrofly,项目名称:nodatime,代码行数:8,代码来源:ZoneRecurrenceTest.cs


示例7: PreviousOrSame_AfterLastYear

 public void PreviousOrSame_AfterLastYear()
 {
     var januaryFirstMidnight = new ZoneYearOffset(TransitionMode.Utc, 1, 1, 0, true, LocalTime.Midnight);
     var recurrence = new ZoneRecurrence("bob", Offset.Zero, januaryFirstMidnight, 1970, 1972);
     Transition? actual = recurrence.PreviousOrSame(Instant.MaxValue, Offset.Zero, Offset.Zero);
     Transition? expected = new Transition(Instant.FromUtc(1972, 1, 1, 0, 0), Offset.Zero);
     Assert.AreEqual(expected, actual);
 }
开发者ID:ivandrofly,项目名称:nodatime,代码行数:8,代码来源:ZoneRecurrenceTest.cs


示例8: ParseDateTimeOfYear_missingAt_validForZone

 public void ParseDateTimeOfYear_missingAt_validForZone()
 {
     const string text = "Mar lastSun";
     var tokens = Tokens.Tokenize(text);
     var actual = Parser.ParseDateTimeOfYear(tokens, false);
     var expected = new ZoneYearOffset(TransitionMode.Wall, 3, -1, (int) IsoDayOfWeek.Sunday, false, LocalTime.Midnight);
     Assert.AreEqual(expected, actual);
 }
开发者ID:KonstantinDavidov,项目名称:nodatime,代码行数:8,代码来源:TzdbZoneInfoParserTest.cs


示例9: Equality

 public void Equality()
 {
     var yearOffset = new ZoneYearOffset(TransitionMode.Utc, 10, 31, (int)IsoDayOfWeek.Wednesday, true, LocalTime.Midnight);
     var recurrence = new ZoneRecurrence("bob", Offset.Zero, yearOffset, 1971, 2009);
     var actual = new RuleLine(recurrence, "D", null);
     var expected = new RuleLine(recurrence, "D", null);
     Assert.AreEqual(expected, actual);
 }
开发者ID:ivandrofly,项目名称:nodatime,代码行数:8,代码来源:ZoneLineTest.cs


示例10: ParseDateTimeOfYear_missingOn_validForZone

 public void ParseDateTimeOfYear_missingOn_validForZone()
 {
     const string text = "Mar";
     var tokens = Tokens.Tokenize(text);
     var actual = Parser.ParseDateTimeOfYear(tokens, false);
     var expected = new ZoneYearOffset(TransitionMode.Wall, 3, 1, 0, false, LocalTime.Midnight);
     Assert.AreEqual(expected, actual);
 }
开发者ID:KonstantinDavidov,项目名称:nodatime,代码行数:8,代码来源:TzdbZoneInfoParserTest.cs


示例11: RenameAppend

 public void RenameAppend()
 {
     var yearOffset = new ZoneYearOffset(TransitionMode.Utc, 10, 31, (int)IsoDayOfWeek.Wednesday, true, Offset.Zero);
     var old = new ZoneRecurrence("bob", Offset.Zero, yearOffset, 1971, 2009);
     var actual = old.RenameAppend("-Summer");
     var expected = new ZoneRecurrence("bob-Summer", Offset.Zero, yearOffset, 1971, 2009);
     Assert.AreEqual(expected, actual);
 }
开发者ID:manirana007,项目名称:NodaTime,代码行数:8,代码来源:ZoneRecurrenceTest.cs


示例12: Next_BeyondLastYear_null

 public void Next_BeyondLastYear_null()
 {
     var afterRecurrenceEnd = Instant.FromUtc(1980, 1, 1, 0, 0);
     var januaryFirstMidnight = new ZoneYearOffset(TransitionMode.Utc, 1, 1, 0, true, LocalTime.Midnight);
     var recurrence = new ZoneRecurrence("bob", Offset.Zero, januaryFirstMidnight, 1970, 1972);
     Transition? actual = recurrence.Next(afterRecurrenceEnd, Offset.Zero, Offset.Zero);
     Transition? expected = null;
     Assert.AreEqual(expected, actual);
 }
开发者ID:ivandrofly,项目名称:nodatime,代码行数:9,代码来源:ZoneRecurrenceTest.cs


示例13: FormatName_Slash_Daylight

        public void FormatName_Slash_Daylight()
        {
            var yearOffset = new ZoneYearOffset(TransitionMode.Utc, 10, 31, (int) IsoDayOfWeek.Wednesday, true, LocalTime.Midnight);
            var recurrence = new ZoneRecurrence("ignored", Offset.FromHours(1), yearOffset, 1971, 2009);
            var rule = new RuleLine(recurrence, "!", null);
            var zone = GetZone("X/Y", Offset.FromHours(1));

            var zoneRecurrence = rule.GetRecurrences(zone).Single();
            Assert.AreEqual("Y", zoneRecurrence.Name);
        }
开发者ID:nicklbailey,项目名称:nodatime,代码行数:10,代码来源:ZoneRuleTest.cs


示例14: FormatName_PercentS

        public void FormatName_PercentS()
        {
            // Note that the offset is irrelevant here - the "daylight saving indicator" is replaced either way.
            var yearOffset = new ZoneYearOffset(TransitionMode.Utc, 10, 31, (int) IsoDayOfWeek.Wednesday, true, LocalTime.Midnight);
            var recurrence = new ZoneRecurrence("ignored", Offset.Zero, yearOffset, 1971, 2009);
            var rule = new RuleLine(recurrence, "!", null);
            var zone = GetZone("X%sY", Offset.Zero);

            var zoneRecurrence = rule.GetRecurrences(zone).Single();
            Assert.AreEqual("X!Y", zoneRecurrence.Name);
        }
开发者ID:nicklbailey,项目名称:nodatime,代码行数:11,代码来源:ZoneRuleTest.cs


示例15: FormatName_PercentZ

        public void FormatName_PercentZ()
        {
            var yearOffset = new ZoneYearOffset(TransitionMode.Utc, 10, 31, (int) IsoDayOfWeek.Wednesday, true, LocalTime.Midnight);
            var recurrence = new ZoneRecurrence("Rule", Offset.FromHoursAndMinutes(5, 30), yearOffset, 1971, 2009);
            var rule = new RuleLine(recurrence, "D", null);
            
            var zoneRecurrence = rule.GetRecurrences(GetZone("X%zY", Offset.Zero)).Single();
            Assert.AreEqual("X+0530Y", zoneRecurrence.Name);

            zoneRecurrence = rule.GetRecurrences(GetZone("X%zY", Offset.FromHoursAndMinutes(0, 30))).Single();
            Assert.AreEqual("X+06Y", zoneRecurrence.Name);

            zoneRecurrence = rule.GetRecurrences(GetZone("X%zY", Offset.FromHoursAndMinutes(-6, -30))).Single();
            Assert.AreEqual("X-01Y", zoneRecurrence.Name);
        }
开发者ID:nicklbailey,项目名称:nodatime,代码行数:15,代码来源:ZoneRuleTest.cs


示例16: PreviousTwice_JanOne

 public void PreviousTwice_JanOne()
 {
     var offset = new ZoneYearOffset(TransitionMode.Utc, 1, 1, 0, true, Offset.Zero);
     var actual = offset.MakeInstant(1970, Offset.Zero, Offset.Zero);
     long baseTicks = actual.Ticks;
     actual = offset.Previous(actual, Offset.Zero, Offset.Zero);
     actual = offset.Previous(actual, Offset.Zero, Offset.Zero);
     var expected = new Instant(baseTicks - (TicksPerStandardYear + TicksPerLeapYear));
     Assert.AreEqual(expected, actual);
 }
开发者ID:manirana007,项目名称:NodaTime,代码行数:10,代码来源:ZoneYearOffsetTest.cs


示例17: Previous_OneSecondAfterJanOne

 public void Previous_OneSecondAfterJanOne()
 {
     var offset = new ZoneYearOffset(TransitionMode.Utc, 1, 1, 0, true, Offset.Zero);
     var actual = offset.MakeInstant(1970, Offset.Zero, Offset.Zero) + Duration.One;
     actual = offset.Previous(actual, Offset.Zero, Offset.Zero);
     var expected = Instant.UnixEpoch;
     Assert.AreEqual(expected, actual);
 }
开发者ID:manirana007,项目名称:NodaTime,代码行数:8,代码来源:ZoneYearOffsetTest.cs


示例18: NextTwice_Feb29_FourYears

 public void NextTwice_Feb29_FourYears()
 {
     var offset = new ZoneYearOffset(TransitionMode.Utc, 2, 29, 0, true, Offset.Zero);
     var actual = offset.MakeInstant(1972, Offset.Zero, Offset.Zero);
     long baseTicks = actual.Ticks;
     actual = offset.Next(actual, Offset.Zero, Offset.Zero);
     actual = offset.Next(actual, Offset.Zero, Offset.Zero);
     var expected = new Instant(baseTicks + (2 * ((3 * TicksPerStandardYear) + TicksPerLeapYear)));
     Assert.AreEqual(expected, actual);
 }
开发者ID:manirana007,项目名称:NodaTime,代码行数:10,代码来源:ZoneYearOffsetTest.cs


示例19: Next_OneSecondBeforeJanOne

 public void Next_OneSecondBeforeJanOne()
 {
     var offset = new ZoneYearOffset(TransitionMode.Utc, 1, 1, 0, true, Offset.Zero);
     var actual = offset.MakeInstant(1970, Offset.Zero, Offset.Zero) - Duration.One;
     actual = offset.Next(actual, Offset.Zero, Offset.Zero);
     var expected = Instant.UnixEpoch;
     Assert.AreEqual(expected, actual);
 }
开发者ID:manirana007,项目名称:NodaTime,代码行数:8,代码来源:ZoneYearOffsetTest.cs


示例20: Next_JanOne

 public void Next_JanOne()
 {
     var offset = new ZoneYearOffset(TransitionMode.Utc, 1, 1, 0, true, Offset.Zero);
     var actual = offset.MakeInstant(1970, Offset.Zero, Offset.Zero);
     long baseTicks = actual.Ticks;
     actual = offset.Next(actual, Offset.Zero, Offset.Zero);
     var expected = new Instant(baseTicks + (1 * TicksPerStandardYear));
     Assert.AreEqual(expected, actual);
 }
开发者ID:manirana007,项目名称:NodaTime,代码行数:9,代码来源:ZoneYearOffsetTest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ZooKeeperNet类代码示例发布时间:2022-05-24
下一篇:
C# Zone类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap