Пример #1
0
 public void ParseZone_withDayOfWeek()
 {
     var parser = new TzdbZoneInfoParser();
     var tokens = Tokens.Tokenize("2:00 US P%sT 1969 Mar lastSun");
     var expected = new ZoneLine(string.Empty, ToOffset(2, 0), "US", "P%sT", 1969, new ZoneYearOffset(TransitionMode.Wall, 3, -1, (int) IsoDayOfWeek.Sunday, false, LocalTime.Midnight));
     Assert.AreEqual(expected, parser.ParseZone(string.Empty, tokens));
 }
Пример #2
0
 public void ParseZone_withYearMonthDayTimeZone()
 {
     var parser = new TzdbZoneInfoParser();
     var tokens = Tokens.Tokenize("2:00 US P%sT 1969 Mar 23 14:53:27.856s");
     var expected = new ZoneLine(string.Empty, ToOffset(2, 0), "US", "P%sT", 1969, new ZoneYearOffset(TransitionMode.Standard, 3, 23, 0, false, new LocalTime(14, 53, 27, 856)));
     Assert.AreEqual(expected, parser.ParseZone(string.Empty, tokens));
 }
Пример #3
0
 public void ParseZone_withYear()
 {
     var parser = new TzdbZoneInfoParser();
     var tokens = Tokens.Tokenize("2:00 US P%sT 1969");
     var expected = new ZoneLine(string.Empty, ToOffset(2, 0), "US", "P%sT", 1969, new ZoneYearOffset(TransitionMode.Wall, 1, 1, 0, false, LocalTime.Midnight));
     Assert.AreEqual(expected, parser.ParseZone(string.Empty, tokens));
 }
Пример #4
0
 public void ParseZone_tooFewWords2_exception()
 {
     var parser = new TzdbZoneInfoParser();
     var tokens = Tokens.Tokenize("2:00");
     Assert.Throws(typeof(InvalidDataException), () => parser.ParseZone(string.Empty, tokens));
 }
Пример #5
0
 public void ParseZone_simple()
 {
     var parser = new TzdbZoneInfoParser();
     var tokens = Tokens.Tokenize("2:00 US P%sT");
     var expected = new ZoneLine(string.Empty, ToOffset(2, 0), "US", "P%sT", int.MaxValue, ZoneYearOffset.StartOfYear);
     Assert.AreEqual(expected, parser.ParseZone(string.Empty, tokens));
 }
Пример #6
0
 public void ParseZone_badOffset_exception()
 {
     var parser = new TzdbZoneInfoParser();
     var tokens = Tokens.Tokenize("asd US P%sT 1969 Mar 23 14:53:27.856s");
     Assert.Throws(typeof(FormatException), () => parser.ParseZone(string.Empty, tokens));
 }