コード例 #1
0
 public void GetZoneIntervals_GapAroundAndInTailZoneTransition()
 {
     // Tail zone is -10 / +5, with the transition occurring just after
     // the transition *to* the tail zone from the precalculated zone.
     // A local instant of one hour after the transition from the precalculated zone (which is -5)
     // will therefore be in the gap. No zone interval matches, so the result is
     // an empty pair.
     var tailZone = new SingleTransitionZone(ThirdInterval.End + Duration.FromHours(1), -10, +5);
     var gapZone = new PrecalculatedDateTimeZone("Test",
         new[] { FirstInterval, SecondInterval, ThirdInterval }, tailZone);
     var pair = gapZone.GetZoneIntervals(ThirdInterval.LocalEnd + Duration.FromHours(1));
     Assert.IsNull(pair.EarlyInterval);
     Assert.IsNull(pair.LateInterval);
 }
コード例 #2
0
 public void TrickyCase()
 {
     // 1am occurs unambiguously in the early zone.
     var zone = new SingleTransitionZone(Transition, Offset.FromHours(3), Offset.FromHours(5));
     var actual = zone.GetZoneIntervals(new LocalInstant(2000, 1, 1, 1, 0));
     var expected = ZoneIntervalPair.Unambiguous(zone.EarlyInterval);
     Assert.AreEqual(expected, actual);
 }
コード例 #3
0
 public void GetZoneIntervals_AmbiguousButTooEarlyInTailZoneTransition()
 {
     // Tail zone is +10 / +8, with the transition occurring just after
     // the transition *to* the tail zone from the precalculated zone.
     // A local instant of one hour before after the transition from the precalculated zone (which is -5)
     // will therefore be ambiguous, but the resulting instants from the ambiguity occur
     // before our transition into the tail zone, so are ignored.
     var tailZone = new SingleTransitionZone(ThirdInterval.End + Duration.FromHours(1), 10, 8);
     var gapZone = new PrecalculatedDateTimeZone("Test",
         new[] { FirstInterval, SecondInterval, ThirdInterval }, tailZone);
     var pair = gapZone.GetZoneIntervals(ThirdInterval.LocalEnd - Duration.FromHours(1));
     Assert.AreEqual(ThirdInterval, pair.EarlyInterval);
     Assert.IsNull(pair.LateInterval);
 }