public void CannotParseUnknownZones() { foreach (string zone in new string[] { "ZT", "ZZT", "EZT", "ZST" }) { try { InternetDate.Parse("Sun, 26 Feb 2006 17:52:20 " + zone); Assert.Fail("{0} is not a valid zone.", zone); } catch (FormatException) { continue; } } }
public void CannotParseBelowMinimumLength() { InternetDate.Parse("1234567890"); }
public void CannotParseEmpty() { InternetDate.Parse(string.Empty); }
public void CannotParseNull() { InternetDate.Parse(null); }
private static void AssertParse(string expected, string input) { DateTime time = InternetDate.Parse(input); Assert.AreEqual(expected, time.ToUniversalTime().ToString("r"), "Input = " + input); }
public void NoTimeZoneDelimiter() { InternetDate.Parse("Sun,26-Feb-2006T22:52:20+0100"); }
public void WrongLocalDifferentialLength() { InternetDate.Parse("Sun, 26 Feb 2006 22:52:20 100"); }
public void BadLocalDifferential() { InternetDate.Parse("Sun, 26 Feb 2006 21:52:20 HHMM"); }
public void MissingTimeZone() { InternetDate.Parse("Sun, 26 Feb 2006 21:52:20"); }
public void EmptyTimeZone() { InternetDate.Parse("Sun, 26 Feb 2006 21:52:20 "); }