public void TestMethod1(IServicePessoa servicePessoa) { //Teste Unitário //_pessoa = new Domain.Entities.Pessoa("Almeida", "11040128637", "GO", "01/01/2000"); //Teste de CRUD request = new PessoaRequest("Paulo", "11040128637", "01/01/2000", "GO", "123456"); _servicePessoa = servicePessoa; PessoaResponse response = _servicePessoa.CadastrarPessoa(request); if (response == null) { throw new Exception("Erro"); } }
public async Task <IActionResult> Post([FromBody] PessoaRequest request) { try { PessoaResponse response = _servicePessoa.CadastrarPessoa(request); if (response.CPF != null) { return(await ResponseAsync(response)); } else { return(CreatedAtAction("Post", new { HttpStatusCode.BadRequest })); } } catch (Exception ex) { return(CreatedAtAction("Post", new { HttpStatusCode.ServiceUnavailable }));; } }