Пример #1
0
 public void ParseDateTimeOfYear_missingOn_invalidForRule()
 {
     var parser = new TzdbZoneInfoParser();
     const string text = "Mar";
     var tokens = Tokens.Tokenize(text);
     Assert.Throws(typeof(InvalidDataException), () => parser.ParseDateTimeOfYear(tokens, true));
 }
Пример #2
0
 public void ParseDateTimeOfYear_onAfter()
 {
     var parser = new TzdbZoneInfoParser();
     const string text = "Mar Tue>=14 2:00";
     var tokens = Tokens.Tokenize(text);
     var actual = parser.ParseDateTimeOfYear(tokens, true);
     var expected = new ZoneYearOffset(TransitionMode.Wall, 3, 14, (int)IsoDayOfWeek.Tuesday, true, new LocalTime(2, 0));
     Assert.AreEqual(expected, actual);
 }
Пример #3
0
 public void ParseDateTimeOfYear_missingOn_validForZone()
 {
     var parser = new TzdbZoneInfoParser();
     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);
 }
Пример #4
0
 public void Parse_2400_Last()
 {
     var parser = new TzdbZoneInfoParser();
     const string text = "Mar lastSun 24:00";
     var tokens = Tokens.Tokenize(text);
     var actual = parser.ParseDateTimeOfYear(tokens, true);
     var expected = new ZoneYearOffset(TransitionMode.Wall, 3, -1, (int)IsoDayOfWeek.Sunday, false, LocalTime.Midnight, true);
     Assert.AreEqual(expected, actual);
 }
Пример #5
0
 public void Parse_2400_FromDay_AtMost_Wednesday()
 {
     var parser = new TzdbZoneInfoParser();
     const string text = "Apr Wed<=14  24:00";
     var tokens = Tokens.Tokenize(text);
     var rule = parser.ParseDateTimeOfYear(tokens, true);
     var actual = rule.GetOccurrenceForYear(2012);
     var expected = new LocalDateTime(2012, 4, 12, 0, 0).ToLocalInstant();
     Assert.AreEqual(expected, actual);
 }
Пример #6
0
 public void ParseDateTimeOfYear_emptyString()
 {
     var parser = new TzdbZoneInfoParser();
     var tokens = Tokens.Tokenize(string.Empty);
     Assert.Throws(typeof(InvalidDataException), () => parser.ParseDateTimeOfYear(tokens, true));
 }