private void CheckInvalidParsedValue(string input, int startIndex, bool supportsMultipleValues) { MediaTypeHeaderParser parser = null; if (supportsMultipleValues) { parser = MediaTypeHeaderParser.MultipleValuesParser; } else { parser = MediaTypeHeaderParser.SingleValueParser; } object result = null; int newIndex = startIndex; Assert.False(parser.TryParseValue(input, null, ref newIndex, out result), string.Format("TryParse returned true. Input: '{0}', Index: {1}", input, startIndex)); Assert.Null(result); Assert.Equal(startIndex, newIndex); }
private void CheckValidParsedValue(string input, int startIndex, MediaTypeHeaderValue expectedResult, int expectedIndex, bool supportsMultipleValues) { MediaTypeHeaderParser parser = null; if (supportsMultipleValues) { parser = MediaTypeHeaderParser.MultipleValuesParser; } else { parser = MediaTypeHeaderParser.SingleValueParser; } object result = null; Assert.True(parser.TryParseValue(input, null, ref startIndex, out result), string.Format("TryParse returned false. Input: '{0}', Index: {1}", input, startIndex)); Assert.Equal(expectedIndex, startIndex); Assert.Equal(expectedResult, result); }