Esempio n. 1
0
        public static void EmptyInput()
        {
            using var tr = new TextBufferReader(new char[0]);
            char[] buffer = new char[10];
            int    read   = tr.Read(buffer, 0, 1);

            Equal(0, read);
        }
Esempio n. 2
0
        public static void ReadFromFragmentedBuffer()
        {
            var data = ToReadOnlySequence <char>(SmallData, 3);

            using var tr = new TextBufferReader(data);
            var array = new char[data.Length];

            Equal(3, tr.Read(array, 0, array.Length));
            Equal(new[] { 'H', 'E', 'L' }, array[0..3]);
Esempio n. 3
0
        public void NotEndOfStream(ReadOnlySequence <char> smallData)
        {
            using var tr = new TextBufferReader(smallData);
            char[] charBuff = new char[3];
            var    result   = tr.Read(charBuff, 0, 3);

            Equal(3, result);
            Equal("HEL", new string(charBuff));
            False(tr.Peek() == -1, "End of TextReader was true after ReadToEnd");
        }
Esempio n. 4
0
        public static void TestRead(ReadOnlySequence <char> charData)
        {
            using var tr = new TextBufferReader(charData);
            var expectedData = charData.ToArray();

            for (var count = 0; count < expectedData.Length; ++count)
            {
                var tmp = tr.Read();
                Equal(expectedData[count], tmp);
            }
        }
Esempio n. 5
0
 public static void ReadZeroCharacters()
 {
     using var tr = new TextBufferReader(CharData);
     Equal(0, tr.Read(new char[0], 0, 0));
 }