private void CheckParse(String from, String fmt, HdTimeSpan expected) { HdTimeSpan parsed = HdTimeSpan.Parse(from, fmt); if (!expected.Equals(parsed)) { // Comparison is here to avoid problems with Formatter affecting tests for Parser Assert.AreEqual(expected, parsed); Assert.AreEqual(expected.ToString(), parsed.ToString()); } Assert.AreEqual(expected.TotalNanoseconds, parsed.TotalNanoseconds); }
private void CheckFormatFail(String from, String fmt, String msg) { try { HdTimeSpan.Parse(from, fmt); } catch (FormatError e) { if (e.Message.Contains(msg)) { return; } } Assert.Fail("Was expected to throw"); }