예제 #1
0
        public void BytesReaderParse()
        {
            ulong u64;
            bool  b;

            ReadOnlyBytes bytes  = Parse("12|3Tr|ue|456Tr|ue7|89False|");
            var           reader = new BytesReader(bytes);

            Assert.True(reader.TryParseUInt64(out u64));
            Assert.Equal(123ul, u64);

            Assert.True(reader.TryParseBoolean(out b));
            Assert.Equal(true, b);

            Assert.True(reader.TryParseUInt64(out u64));
            Assert.Equal(456ul, u64);

            Assert.True(reader.TryParseBoolean(out b));
            Assert.Equal(true, b);

            Assert.True(reader.TryParseUInt64(out u64));
            Assert.Equal(789ul, u64);

            Assert.True(reader.TryParseBoolean(out b));
            Assert.Equal(false, b);

            //Assert.True(reader.IsEmpty);
        }