コード例 #1
0
        public async Task ReverseReadsNextAsync()
        {
            var firstPageCount = 10;
            var nextPageCount  = 3;
            var logReader      = new PageReaderData()
            {
                Id    = Fixture.TestName,
                Count = firstPageCount
            };
            long pageTop    = PageReaderData.EOF;
            long pageBottom = (Fixture.LineCount - logReader.Count) * Fixture.TextLine(0).Length;

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

            await LogPageReader.ReadFirstAsync(logReader);

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

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

            await LogPageReader.ReadNextAsync(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(Fixture.LineCount - firstPageCount - i), logReader.Lines.Skip(i).First());
            }
        }
コード例 #2
0
 public async Task <ActionResult> ReverseNext(PageReaderData logReader)
 {
     return(List(await LogPageReader.ReadNextAsync(logReader)));
 }