Beispiel #1
0
        public async Task Should_Get_Feedstock_List()
        {
            var listFeedstockQueryHandler = new ListFeedstockQueryHandler(_feedstockRepository);
            var request = ListFeedstockQueryRequest.New("nome", "ASC", 1, 1);

            var pagination = await listFeedstockQueryHandler.Handle(request, new CancellationToken());

            Assert.NotNull(pagination);
        }
Beispiel #2
0
        public async Task <IPagination <FeedstockQueryDto> > Handle(ListFeedstockQueryRequest request, CancellationToken cancellationToken)
        {
            var pagination = await _colorRepository.ListAsync(request.Filter, request.OrderBy, request.Page, request.QtyPerPage);

            if (pagination.IsEmpty())
            {
                return(Pagination <FeedstockQueryDto> .Empty);
            }

            var colorDtos = FeedstockMapper.Map(pagination.Entities);

            var paginationDto = Pagination <FeedstockQueryDto> .New(colorDtos, pagination.TotalPages, pagination.ItemsPerPage, pagination.CurrentPage);

            return(paginationDto);
        }