Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }