Ejemplo n.º 1
0
        public static async Task ReadToEndAsync(ReadOnlySequence <char> largeData)
        {
            using var tr = largeData.AsTextReader();
            var result = await tr.ReadToEndAsync();

            Equal(5000, result.Length);
        }
Ejemplo n.º 2
0
        public static void EndOfStream(ReadOnlySequence <char> smallData)
        {
            using var tr = smallData.AsTextReader();
            var result = tr.ReadToEnd();

            Equal("HELLO", result);
            True(tr.Peek() == -1, "End of TextReader was not true after ReadToEnd");
        }
Ejemplo n.º 3
0
        public void NotEndOfStream(ReadOnlySequence <char> smallData)
        {
            using var tr = smallData.AsTextReader();
            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");
        }
Ejemplo n.º 4
0
        public static void TestRead(ReadOnlySequence <char> charData)
        {
            using var tr = charData.AsTextReader();
            var expectedData = charData.ToArray();

            for (var count = 0; count < expectedData.Length; ++count)
            {
                var tmp = tr.Read();
                Equal(expectedData[count], tmp);
            }
        }