示例#1
0
        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);
        }
示例#2
0
        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");
        }