Exemple #1
0
        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);
        }
Exemple #2
0
        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);
            }
        }