Пример #1
0
        public async Task GetUndoneForTodayToDoCommandHandlerTestShouldReturnGetUndoneForTodayToDoCommandObject()
        {
            var command = new GetUndoneForTodayToDoCommand
            {
                User = "******"
            };

            var handler = new GetUndoneForTodayToDoCommandHandler(_toDoRepositoryMock.Object);

            _toDoRepositoryMock.Setup(a => a.Search(a => a.User == command.User && !a.Done && a.Date == DateTime.Now.Date)).ReturnsAsync(listToDoItem);

            //Act
            var result = await handler.Handle(command, new CancellationToken());

            result.Should().NotBeEmpty();
        }
        public async Task <IEnumerable <TodoItem> > Handle(GetUndoneForTodayToDoCommand request, CancellationToken cancellationToken)
        {
            var dados = await _todoRepository.Search(a => a.User == request.User && !a.Done && a.Date == DateTime.Now.Date);

            return(await Task.FromResult(dados));
        }