本文整理汇总了C#中ZoneYearOffset类的典型用法代码示例。如果您正苦于以下问题:C# ZoneYearOffset类的具体用法?C# ZoneYearOffset怎么用?C# ZoneYearOffset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ZoneYearOffset类属于命名空间,在下文中一共展示了ZoneYearOffset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}