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); }
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]);
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"); }
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); } }
public static void ReadZeroCharacters() { using var tr = new TextBufferReader(CharData); Equal(0, tr.Read(new char[0], 0, 0)); }