public void SetsIsDoneTrue() { var todoListItem = new TodoListItem(); todoListItem.ChangeStatus(true); Assert.True(todoListItem.IsDone); }
public async Task <int> Handle(UpdateTodoListItemCommand request, CancellationToken cancellationToken) { var updateColumns = new List <string> { nameof(TodoListItem.IsDone) }; var todoListItem = new TodoListItem(); todoListItem.ChangeStatus(request.IsDone); var affected = await _applicationDbContext.TodoListItems.GetById(request.Id).BatchUpdateAsync(todoListItem, updateColumns, cancellationToken); if (affected == 0) { throw new NotFoundException(nameof(TodoList), request.Id); } return(affected); }