Beispiel #1
0
        public void ForwardReadsNext()
        {
            var firstPageCount = 10;
            var nextPageCount  = 3;
            var logReader      = new PageReaderData()
            {
                Id    = Fixture.TestName,
                Count = firstPageCount
            };
            long pageTop    = PageReaderData.EOF;
            long pageBottom = (firstPageCount) * Fixture.TextLine(0).Length;

            Assert.True(Fixture.LineCount > firstPageCount + nextPageCount, "Not enough lines to perform test.");

            PageReader.ReadFirst(logReader);

            Assert.Equal(pageTop, logReader.PageTop);
            Assert.Equal(pageBottom, logReader.PageBottom);
            Assert.Equal(firstPageCount, logReader.Lines.Count());

            pageTop         = pageBottom;
            pageBottom      = (firstPageCount + nextPageCount) * Fixture.TextLine(0).Length;
            logReader.Count = nextPageCount;

            PageReader.ReadNext(logReader);

            Assert.Equal(pageTop, logReader.PageTop);
            Assert.Equal(pageBottom, logReader.PageBottom);
            Assert.Equal(nextPageCount, logReader.Lines.Count());
            for (var i = 0; i < nextPageCount; i++)
            {
                Assert.Equal(Fixture.Text(firstPageCount + i + 1), logReader.Lines.Skip(i).First());
            }
        }