Beispiel #1
0
        public async Task ForwardReadsPrevAsync()
        {
            var lastPageCount = 10;
            var prevPageCount = 3;
            var logReader     = new PageReaderData()
            {
                Id    = Fixture.TestName,
                Count = lastPageCount
            };
            long pageTop    = (Fixture.LineCount - lastPageCount) * Fixture.TextLine(0).Length;
            long pageBottom = PageReaderData.EOF;

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

            await PageReader.ReadLastAsync(logReader);

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

            pageBottom      = pageTop;
            pageTop         = (Fixture.LineCount - lastPageCount - prevPageCount) * Fixture.TextLine(0).Length;
            logReader.Count = prevPageCount;

            await PageReader.ReadPrevAsync(logReader);

            Assert.Equal(pageTop, logReader.PageTop);
            Assert.Equal(pageBottom, logReader.PageBottom);
            Assert.Equal(prevPageCount, logReader.Lines.Count());
            for (var i = 0; i < prevPageCount; i++)
            {
                Assert.Equal(Fixture.Text(lastPageCount + prevPageCount + i), logReader.Lines.Skip(i).First());
            }
        }
 public async Task <ActionResult> ForwardLast(PageReaderData logReader)
 {
     return(List(await PageReader.ReadLastAsync(logReader)));
 }