コード例 #1
0
        public async Task GetListTModelAsync_Success(QueryParameters <FakeEntity, int> queryParameters, IQueryable <FakeEntity> queryable, IQueryable <FakeEntity> countQueryable)
        {
            ValidateQueryParametersMemberData(queryable, countQueryable);

            // Arrange & Act & Assert
            ObjectAssert.ValueEquals(_fixture.DataMapper.Map <FakeModel>(_fixture.UnitOfWork.FakeEntityRepository.ProtectedQuery(queryParameters)).ToList(), await _fixture.UnitOfWork.FakeEntityRepository.GetListAsync <FakeModel>(_fixture.DataMapper, queryParameters));
        }
コード例 #2
0
        public async Task GetPagedListTModelAsync_Success(QueryParameters <FakeEntity, int> queryParameters, IQueryable <FakeEntity> queryable, IQueryable <FakeEntity> countQueryable)
        {
            ValidateQueryParametersMemberData(queryable, countQueryable);

            if (queryParameters?.Page == null || queryParameters.Page.IsValid == false)
            {
                return;
            }

            // Arrange
            var pagedResultQuery = _fixture.UnitOfWork.FakeEntityRepository.ProtectedPagedResultQuery <FakeModel>(_fixture.DataMapper, queryParameters);

            var expectedPagedResult = new PagedResult <FakeModel>
            {
                PageIndex  = queryParameters.Page.Index,
                PageSize   = queryParameters.Page.Size,
                Items      = pagedResultQuery.ToList(),
                TotalCount = _fixture.UnitOfWork.FakeEntityRepository.Count(queryParameters)
            };

            // Act & Assert
            ObjectAssert.ValueEquals(expectedPagedResult, await _fixture.UnitOfWork.FakeEntityRepository.GetPagedListAsync <FakeModel>(_fixture.DataMapper, queryParameters));
        }