public ContextQueryBuilder(IEngineContext <TItem> context, [CanBeNull] IRestCollectionQuery query)
        {
            _query   = query;
            _context = context;

            _pager = new QueryablePager <TItem>(_query?.PageInstruction);
        }
        public void PageSize_InstructionNoSize_GivesDefault()
        {
            var pager = new QueryablePager <Person>(new PageInstruction {
                Size = null
            });

            Assert.Equal(100, pager.PageSize);
        }
        public void PageSize_InstructionWithSize_Correct()
        {
            var pager = new QueryablePager <Person>(new PageInstruction {
                Size = 50
            });

            Assert.Equal(50, pager.PageSize);
        }
        public void ApplyPagination_QueryableSizeAndPageNum_ExpectedCount(int originalSize, int instructionSize, int instructionPageNum, int expectedCount)
        {
            var fixture      = new Fixture();
            var bigQueryable = fixture.CreateMany <Person>(originalSize).AsQueryable();

            var pager = new QueryablePager <Person>(new PageInstruction {
                Size = instructionSize, PageNumber = instructionPageNum
            });
            var pagedQueryable = pager.ApplyPagination(bigQueryable);

            Assert.Equal(expectedCount, pagedQueryable.Count());
        }