private void CheckInvalidParsedValue(string input, int startIndex) { ByteArrayHeaderParser parser = ByteArrayHeaderParser.Parser; object result = 0; int newIndex = startIndex; Assert.False(parser.TryParseValue(input, null, ref newIndex, out result)); Assert.Equal(null, result); Assert.Equal(startIndex, newIndex); }
private void CheckValidParsedValue(string input, int startIndex, byte[] expectedResult, int expectedIndex) { ByteArrayHeaderParser parser = ByteArrayHeaderParser.Parser; object result = 0; Assert.True(parser.TryParseValue(input, null, ref startIndex, out result)); Assert.Equal(expectedIndex, startIndex); if (result == null) { Assert.Null(expectedResult); } else { byte[] arrayResult = (byte[])result; Assert.Equal(expectedResult, arrayResult); } }