public void DadoUmComandoInvalido() { var invalidCommand = new DeleteRegionCommand(0, "", ""); invalidCommand.Validate(); Assert.False(invalidCommand.Valid); }
public void DadoUmComandoValido() { var validCommand = new DeleteRegionCommand(1, "MG", "Minas Gerais"); validCommand.Validate(); Assert.True(validCommand.Valid); }
public void DadoUmComandoInvalidoPeloNome() { var invalidCommand = new DeleteRegionCommand(1, "MG", ""); invalidCommand.Validate(); Assert.Equal("O nome da regiĆ£o precisa ter pelo menos 3 letras.", invalidCommand.Notifications.First().Message); }
public void DadoUmComandoInvalidoPelaSigla() { var invalidCommand = new DeleteRegionCommand(1, "", "Minas Gerais"); invalidCommand.Validate(); Assert.Equal("A sigla tem que ter pelo menos 1 letra.", invalidCommand.Notifications.First().Message); }
public void DadoUmComandoInvalidoPelaId() { var invalidCommand = new DeleteRegionCommand(0, "MG", "Minas Gerais"); invalidCommand.Validate(); Assert.Equal("Identidade tem que ser maior que 0.", invalidCommand.Notifications.First().Message); }
public async Task <APIResult> Delete([FromBody] DeleteRegionCommand command) { var rs = await mediator.Send(command); return(new APIResult() { Result = rs }); }
public HandlerResult <DeleteRegionCommand> Delete( [FromServices] IHandler <DeleteRegionCommand> handler, [FromBody] DeleteRegionCommand command) { return(handler.Handle(command)); }