public GenericCommandResult MarkAsDone( [FromBody] UpdateTodoCommand command, [FromServices] TodoHandler handler) { command.User = User.Claims.FirstOrDefault(x => x.Type == "user_id")?.Value; return((GenericCommandResult)handler.Handle(command)); }
public void Dado_um_comando_valido_deve_criar_a_tarefa() { var command = new CreateTodoCommand("Titulo da Tarefa", "Administrador", DateTime.Now); var handler = new TodoHandler(new FakeTodoRepository()); var result = (GenericCommandResult)handler.Handle(command); Assert.AreEqual(result.Success, true); }
public GenericCommandResult MarkAsUndone( [FromBody] MarkTodoAsUndoneCommand command, [FromServices] TodoHandler handler ) { command.User = User.Claims.FirstOrDefault(x => x.Type == "name").Value; return((GenericCommandResult)handler.Handle(command)); }
public void DadoUmComandoValidoDeveCriarTarefa() { var command = new CreateTodoCommand("Titulo da Descrição", DateTime.Now, "Usuário"); var handle = new TodoHandler(new FakeTodoRepository()); ResponseCommand result = (ResponseCommand)handle.Handle(command); Assert.AreEqual(result.Success, true); }
public void Dado_um_comando_invalido_deve_interromper_a_execucao() { var command = new CreateTodoCommand("", "", DateTime.Now); var handler = new TodoHandler(new FakeTodoRepository()); var result = (GenericCommandResult)handler.Handle(command); Assert.AreEqual(result.Success, false); }
public GenericCommandResult MarkAsUndone( [FromBody] MarkTodoAsUndoneCommand command, [FromServices] TodoHandler handler ) { command.User = "******"; return((GenericCommandResult)handler.Handle(command)); }
public GenericCommandResult Create( [FromBody] CreateTodoCommand command, [FromServices] TodoHandler handler ) { command.User = "******"; return((GenericCommandResult)handler.Handle(command)); }
public GenericCommandResult Update( [FromBody] UpdateTodoCommand command, [FromServices] TodoHandler handler ) { command.User = "******"; return((GenericCommandResult)handler.Handle(command)); }
public void DadoUmComandoInvalidoDeveInterromperExecucao() { var command = new CreateTodoCommand("", DateTime.Now, ""); var handle = new TodoHandler(new FakeTodoRepository()); ResponseCommand result = (ResponseCommand)handle.Handle(command); Assert.AreEqual(result.Success, false); }
public GenericCommandResult MarkAsUnDone( [FromBody] MarkTodoAsUndoneCommand command, [FromServices] TodoHandler handler ) { command.User = "******"; return((GenericCommandResult)handler.Handle(command)); }
public GenericCommandResult MarkAsUndone( [FromBody] MarkTodoAsUndoneCommand command, [FromServices] TodoHandler handler ) { command.User = getUserAuthenticated(); return((GenericCommandResult)handler.Handle(command)); }
public GenericCommandResult Update( [FromBody] UpdateTodoCommand command, [FromServices] TodoHandler handler ) { command.User = getUserAuthenticated(); return((GenericCommandResult)handler.Handle(command)); }
public GenericCommandResult MarkAsDone([FromBody] MarkTodoAsDoneCommand command, [FromServices] TodoHandler todoHandler) { var user = User.Claims.FirstOrDefault(us => us.Type.Equals("user_id"))?.Value; command.User = user; return((GenericCommandResult)todoHandler.Handle(command)); }
public GenericCommandResult Create( [FromBody] CreateTodoCommand command, [FromServices] TodoHandler handler ) { command.User = User.Claims.FirstOrDefault(x => x.Type == "user_id")?.Value; //command.User = "******"; return((GenericCommandResult)handler.Handle(command)); }
public GenericCommandResult Create( [FromBody] CreateTodoCommand command, //Quando fizerem um post o Frombory converte o JSON no objeto [FromServices] TodoHandler handler //A partir do que foi configurado no Startup.cs no AddTransient do Handler, vai resolver a dependência rapidamente ) { command.User = getUserAuthenticated(); //O command recebe os dados e passa para o Handler pois é ele quem vai tratar return((GenericCommandResult)handler.Handle(command)); }
public GenericCommandResult Create([FromBody] CreateTodoCommand command, [FromServices] TodoHandler todoHandler) { var t = User.Claims.FirstOrDefault(x => x.Type == "user_id")?.Value; command.User = "******"; var commandResult = (GenericCommandResult)todoHandler.Handle(command); return(commandResult); }
public GenericCommandResult Update( [FromBody] UpdateTodoCommand command, [FromServices] TodoHandler handler ) { command.User = User.Claims.Where(x => x.Type == "name").FirstOrDefault().Value; return((GenericCommandResult)handler.Handle(command)); }
public GenericCommandResult Create( [FromBody] CreateTodoCommand command, [FromServices] TodoHandler handler ) { string user = User.Claims.FirstOrDefault(a => a.Type == "user_id")?.Value; command.User = user; return((GenericCommandResult)handler.Handle(command)); }
public GenericCommandResult MarkTodoAsUndone( [FromBody] MarkTodoAsUndoneCommand command, [FromServices] TodoHandler handler ) { var user = User.Claims.FirstOrDefault(x => x.Type == "user_id")?.Value; command.RefUser = user; return((GenericCommandResult)handler.Handle(command)); }
public GenericCommandResult Update( [FromBody] UpdateTodoCommand command, [FromServices] TodoHandler handler, [FromRoute] Guid id ) { command.Id = id; command.User = User.Claims.FirstOrDefault(x => x.Type == "user_id")?.Value; return((GenericCommandResult)handler.Handle(command)); }
public IActionResult Create([FromBody] CreateTodoCommand commandTodo) { try { commandTodo.User = "******"; return(Ok((GenericCommandResult)_handler.Handle(commandTodo))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public void mark_as_done() { _result = (GenericCommandResult)_handler.Handle(_donecommand); Assert.AreEqual(_result.Success, true); }
public GenericCommandResult MarkAsUndone([FromServices] TodoHandler handler, [FromBody] MarkTodoAsUndoneCommand command) { return((GenericCommandResult)handler.Handle(command)); }
public MarkAsUndoneTodoHandlerTests() { _invalidResult = (GenericCommandResult)_handle.Handle(new MarkTodoAsUndoneCommand()); _validResult = (GenericCommandResult)_handle.Handle(_invalidTodo); }
public void Dado_um_comando_invalido_deve_interromper_a_execucao() { var result = (GenericCommandResult)_handler.Handle(_invalidCommad); Assert.AreEqual(result.Success, false); }
public void Dado_um_comando_invalido_deve_interromper_a_execucao() { _result = (GenericCommandResult)_handler.Handle(_invalidCommand); Assert.IsFalse(_result.Success); }
public void WhenInputCommandValidMustExecution() { _result = (GenericCommandResult)_handler.Handle(_validCommand); Assert.AreEqual(_result.Success, true); }
public void Create_Todo_Handler_invalid_Command() { var handlerResult = (GenericCommandResult)_handler.Handle(_invalidCommand); Assert.AreEqual(handlerResult.Success, false); }