public UpdateTodoHandlerTests() { _todoItemRepository = Substitute.For <ITodoItemRepository>(); _busPublisher = Substitute.For <IBusPublisher>(); _context = Substitute.For <ICorrelationContext>(); _commandHandler = new UpdateTodoHandler(_todoItemRepository, _busPublisher); }
public GenericCommandResult Update( [FromBody] UpdateTodoCommand command, [FromServices] UpdateTodoHandler handler, Guid id ) { if (id != command.Id) { return(new GenericCommandResult(false, "Id não encontrado", false)); } var user = User.Claims.FirstOrDefault(x => x.Type == "user_id")?.Value; command.User = user; return((GenericCommandResult)handler.Handle(command)); }