public void MapLocal_GapAroundAndInTailZoneTransition() { // Tail zone is -10 / +5, with the transition occurring just after // the transition *to* the tail zone from the precalculated zone. // A local time of one hour after the transition from the precalculated zone (which is -5) // will therefore be in the gap. var tailZone = new SingleTransitionDateTimeZone(ThirdInterval.End + Duration.FromHours(1), -10, +5); var gapZone = new PrecalculatedDateTimeZone("Test", new[] { FirstInterval, SecondInterval, ThirdInterval }, tailZone); var mapping = gapZone.MapLocal(ThirdInterval.IsoLocalEnd.PlusHours(1)); Assert.AreEqual(ThirdInterval, mapping.EarlyInterval); Assert.AreEqual(new ZoneInterval("Single-Early", ThirdInterval.End, tailZone.Transition, Offset.FromHours(-10), Offset.Zero), mapping.LateInterval); Assert.AreEqual(0, mapping.Count); }
public void MapLocal_SingleIntervalAroundTailZoneTransition() { // Tail zone is fixed at +5. A local instant of one hour before the transition // from the precalculated zone (which is -5) will therefore give an instant from // the tail zone which occurs before the precalculated-to-tail transition, // and can therefore be ignored, resulting in an overall unambiguous time. var tailZone = new FixedDateTimeZone(Offset.FromHours(5)); var gapZone = new PrecalculatedDateTimeZone("Test", new[] { FirstInterval, SecondInterval, ThirdInterval }, tailZone); var mapping = gapZone.MapLocal(ThirdInterval.IsoLocalEnd.PlusHours(-1)); Assert.AreEqual(ThirdInterval, mapping.EarlyInterval); Assert.AreEqual(ThirdInterval, mapping.LateInterval); Assert.AreEqual(1, mapping.Count); }
public void MapLocal_GapAroundTailZoneTransition() { // Tail zone is fixed at +5. A local time at the transition // from the precalculated zone (which is -5) will therefore give an instant from // the tail zone which occurs before the precalculated-to-tail transition, // and can therefore be ignored, resulting in an overall gap. var tailZone = new FixedDateTimeZone(Offset.FromHours(5)); var gapZone = new PrecalculatedDateTimeZone("Test", new[] { FirstInterval, SecondInterval, ThirdInterval }, tailZone); var mapping = gapZone.MapLocal(ThirdInterval.IsoLocalEnd); Assert.AreEqual(ThirdInterval, mapping.EarlyInterval); Assert.AreEqual(new ZoneInterval("UTC+05", ThirdInterval.End, Instant.AfterMaxValue, Offset.FromHours(5), Offset.Zero), mapping.LateInterval); Assert.AreEqual(0, mapping.Count); }
public void MapLocal_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 SingleTransitionDateTimeZone(ThirdInterval.End + Duration.FromHours(1), 10, 8); var gapZone = new PrecalculatedDateTimeZone("Test", new[] { FirstInterval, SecondInterval, ThirdInterval }, tailZone); var mapping = gapZone.MapLocal(ThirdInterval.IsoLocalEnd.PlusHours(-1)); Assert.AreEqual(ThirdInterval, mapping.EarlyInterval); Assert.AreEqual(ThirdInterval, mapping.LateInterval); Assert.AreEqual(1, mapping.Count); }