public async Task Repository_GetPaginatedWithCustomizedCriteria_ReturnExpectedPaginated() { // arrange var repository = new SmartRepository <Blog, int>(_dbContext, _mapper, _internalRepository); DbHelper.CleanBlog(_dbContext); var blogs = DbHelper.SeedBulkBlogs(_dbContext); var dtoList = _mapper.Map <List <BlogViewModel> >(blogs); var expected = new Paginated <BlogViewModel>(dtoList.Skip(10).Take(10).ToList(), blogs.Count, 2, 10); // act var actual = await repository.GetPaginated <BlogViewModel>(new PaginatedCriteria(2, 10), CancellationToken.None); // assert Assert.Equal(expected, actual, new PaginatedEqualityComparer <BlogViewModel>()); }
public async void Repository_GetPaginatedWithDefaultCriteria_ReturnDefaultPaginated() { // arrange var repository = new SmartRepository <Blog>(_dbContext, _mapper); DbHelper.CleanBlog(_dbContext); var blogs = DbHelper.SeedBulkBlogs(_dbContext); var dtoList = _mapper.Map <List <BlogViewModel> >(blogs); var expected = new Paginated <BlogViewModel>(dtoList.Take(10).ToList(), blogs.Count, 1, 10); // act var actual = await repository.GetPaginated <BlogViewModel>(CancellationToken.None); // assert Assert.Equal(expected, actual, new PaginatedEqualityComparer <BlogViewModel>()); }