private void CheckValidParsedValue(string input, int startIndex, TimeSpan expectedResult, int expectedIndex) { TimeSpanHeaderParser parser = TimeSpanHeaderParser.Parser; object result = 0; Assert.True(parser.TryParseValue(input, null, ref startIndex, out result), string.Format("TryParse returned false: {0}", input)); Assert.Equal(expectedResult, result); Assert.Equal(expectedIndex, startIndex); }
private void CheckInvalidParsedValue(string input, int startIndex) { TimeSpanHeaderParser parser = TimeSpanHeaderParser.Parser; object result = 0; int newIndex = startIndex; Assert.False(parser.TryParseValue(input, null, ref newIndex, out result), string.Format("TryParse returned true: {0}", input)); Assert.Null(result); Assert.Equal(startIndex, newIndex); }