public void FindPaged_TakeNElements_CheckNumElements(int pageSize, int numberOfElements)
        {
            PopulateUsers(numberOfElements);
            var pageOptions = PagedOptionFactory.Build(pageSize, 0, null, null);

            var result = this.Repository.FindPaged <User>(pageOptions, null, null);

            Assert.True(result.Result.Count() == pageSize);
            ClearMemory();
        }
        public async Task FindPagedAsync_TakeNElements_CheckNumElements(int pageSize, int numberOfElements)
        {
            await PopulateUsersAsync(numberOfElements);

            var pageOptions = PagedOptionFactory.Build(pageSize, 0, null, null);

            var result = await this.Repository.FindPagedAsync <User>(pageOptions, null);

            Assert.True(result.Result.Count() == pageSize);
            await ClearMemoryAsync();
        }
        public void FindPaged_Skip_CheckFirstElement(int pageSize, int numberOfElements, int skip, string firstName)
        {
            PopulateUsers(numberOfElements);
            var pageOptions = PagedOptionFactory.Build(pageSize, skip,
                                                       null, SortOptionFactory.Build("Name", SortDirection.Ascending));

            var result     = this.Repository.FindPaged <User>(pageOptions, null);
            var firstValue = result.Result.FirstOrDefault()?.Name;

            Assert.True(firstValue == firstName);
            ClearMemory();
        }
        public void FindPaged_Filter_CheckNumElements(int pageSize, int numberOfElements,
                                                      string filterMember, string filterValue, FilterOperator filterOperator, int numElementsResult)
        {
            PopulateUsers(numberOfElements);
            var pageOptions = PagedOptionFactory.Build(pageSize, 0,
                                                       FilterOptionFactory.Build(filterMember, filterValue, filterOperator), null);

            var result = this.Repository.FindPaged <User>(pageOptions, null);

            Assert.True(result.Result.Count() == numElementsResult);
            ClearMemory();
        }
        public async Task FindPagedAsync_Filter_CheckNumElements(int pageSize, int numberOfElements,
                                                                 string filterMember, string filterValue, FilterOperator filterOperator, int numElementsResult)
        {
            await PopulateUsersAsync(numberOfElements);

            var pageOptions = PagedOptionFactory.Build(pageSize, 0,
                                                       FilterOptionFactory.Build(filterMember, filterValue, filterOperator), null);

            var result = await this.Repository.FindPagedAsync <User>(pageOptions, null);

            Assert.True(result.Result.Count() == numElementsResult);
            await ClearMemoryAsync();
        }
        public async Task FindPagedAsync_Sort_CheckFirstElement(int pageSize, int numberOfElements,
                                                                string sortMember, SortDirection sortDirection, string firstName)
        {
            await PopulateUsersAsync(numberOfElements);

            var pageOptions = PagedOptionFactory.Build(pageSize, 0,
                                                       null, SortOptionFactory.Build(sortMember, sortDirection));

            var result = await this.Repository.FindPagedAsync <User>(pageOptions, null);

            var firstValue = result.Result.FirstOrDefault()?.Name;

            Assert.True(firstValue == firstName);
            await ClearMemoryAsync();
        }