public async Task Handle_WhenRequestIsValid_ShouldReturnPendingTodoListItemDto()
        {
            //Arrange
            var data = TodoListItemTestData.CreateListTodoListItemTestData();

            request = new GetTodoListItemsQuery
            {
                PageNumber = 1,
                PageSize   = 5,
                Status     = 1
            };

            _todoListItemsRepository.CountAsync(Arg.Any <Expression <Func <TodoListItem, bool> > >()).Returns(data.Count);

            _todoListItemsRepository
            .GetAllTodoListItemsByStatusAsync(Arg.Any <TodoListItemStatuses>(), Arg.Any <int>(), Arg.Any <int>()).Returns(data);



            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new TodoListsProfile());
            });

            _mapper = mappingConfig.CreateMapper();

            subject = new GetTodoListItemsQueryHandler(_todoListItemsRepository, _mapper);
            //Act
            var result = await subject.Handle(request, default);

            //Assert

            var todoListItems = new List <TodoListItemDto>();

            foreach (var item in data)
            {
                todoListItems.Add(new TodoListItemDto
                {
                    TodoListItemId = item.TodoListItemId,
                    Name           = item.Name,
                    Description    = item.Description,
                    DueDate        = item.DueDate,
                    CompletedOn    = item.CompletedOn,
                });
            }

            var results = todoListItems.ToPagedList(request.PageNumber, request.PageSize, data.Count);


            result.ShouldBeOfType <PagedList <TodoListItemDto> >();
            result.ShouldBeEquivalentTo(results);
        }
        public async Task <IPagedList <TodoListItemDto> > Handle(GetTodoListItemsQuery request, CancellationToken cancellationToken)
        {
            var query = await _todoListItemsRepository
                        .GetAllTodoListItemsByStatusAsync((TodoListItemStatuses)request.Status, request.PageNumber, request.PageSize, cancellationToken);


            var count = await _todoListItemsRepository.CountAsync(tdl => tdl.Status == (TodoListItemStatuses)request.Status, cancellationToken : cancellationToken);


            var results = _mapper
                          .Map <List <TodoListItemDto> >(query);

            return(results.ToPagedList(request.PageNumber, request.PageSize, count));
        }