public void CheckBuildDinamicQueryWithoutPaginate() { var query = new ProductQueryPaginateSortable { Name = null, SortBy = "Id.DESC" }; var result = Products.BuildDynamicQuery(query, x => new ProductDto { Id = x.Id, Name = x.Name }); result.Should().BeOfType <IQueryable <ProductDto> >(); var productList = result as IQueryable <ProductDto>; productList.Should().HaveCount(7); }
public void CheckBuildDinamicQueryWithPaginate() { var query = new ProductQueryPaginateSortable { Name = "duc", SortBy = "Id.DESC", Paginate = true }; var result = Products.BuildDynamicQuery(query, x => new ProductDto { Id = x.Id, Name = x.Name }); result.Should().BeOfType <PagedResponse <ProductDto> >(); var productList = result as PagedResponse <ProductDto>; productList.Items.Should().HaveCount(3); }