public async Task <ActionResult <IEnumerable <TodoList> > > GetTodoLists([FromQuery] PagingOptions op)
        {
            var todoList = await _todoListService.GetAllTodoList(op);

            var todoListDTO = _mapper.Map <IEnumerable <TodoList>, IEnumerable <TodoListDTO> >(todoList);

            if (todoList == null)
            {
                return(NotFound(new { message = "TodoList does not exists" }));
            }
            return(Ok(todoListDTO));
        }
Exemple #2
0
        public void Test_GetAllTodoList()
        {
            //Arrange
            _mockTodoListRepository.Setup(x => x.GetAllTodoListAsync(op)).ReturnsAsync(_todoList);
            _mockUnitOfWork.Setup(e => e.TodoLists).Returns(_mockTodoListRepository.Object);
            _service = new TodoListService(_mockUnitOfWork.Object);

            //Act
            var result = _service.GetAllTodoList(op).Result;

            //Assert
            _mockTodoListRepository.Verify(); //verify that GetAllTodoListAsync was called based on setup.
            Assert.NotNull(result);
            Assert.That(result.Count() == 3);
        }