public async Task <ActionResult> Edit(int?id) { var todoItemDTO = new TodoItemDTO(); if (id != null) { todoItemDTO = await todoItemService.GetById(id.Value); } return(View(todoItemDTO)); }
public async Task GetById_Should_ReturnRepositoryReturn() { // Arrange var guid = Guid.NewGuid(); var expected = new TodoItem(); _repositoryMock .Setup(x => x.GetById(guid)) .ReturnsAsync(expected); // Act var actual = await _service.GetById(guid); // Assert Assert.Same(expected, actual); }
public ActionResult <TodoItem> GetTodoItemById(int listId, int id) { return(service.GetById(listId, id)); }