public void ShouldReturnSuccessWhenSendAInvalidCommand() { var handler = new CreateUserHandler(new FakeUserRepository()); var result = (CommandResult)handler.handle(FakeCommandCreateUser.invalidCommand()); Assert.AreEqual(false, result.Success); }
public async Task <ActionResult> Post([FromBody] CommandCreateUser command, [FromServices] CreateUserHandler handler) { var result = (CommandResult)handler.handle(command); if (!result.Success) { return(BadRequest(result)); } return(Ok(result)); }