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

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

            await LogPageReader.ReadLastAsync(logReader);

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

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

            await LogPageReader.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());
            }
        }
コード例 #2
0
 public async Task <ActionResult> ReversePrev(PageReaderData logReader)
 {
     return(List(await LogPageReader.ReadPrevAsync(logReader)));
 }