Esempio n. 1
0
        public void ProcessLine_FastPath()
        {
            var test = @"This is the first line
This is the second line
This is the third line, it's quite a bit bigger than the other lines.

This is the fifth line, coming after an empty line";

            var sequence = new ReadOnlySequence <byte>(Encoding.UTF8.GetBytes(test));

            var results = new List <string>();

            sequence.ProcessLine(s => results.Add(s.ToUtf8String()));

            Assert.Equal(4, results.Count);
            Assert.Equal("This is the first line", results[0]);
            Assert.Equal("This is the second line", results[1]);
            Assert.Equal("This is the third line, it's quite a bit bigger than the other lines.", results[2]);
            Assert.Equal("", results[3]);
        }