public void Service_Deve_Obter_Motorista_PorId(int id) { var retorno = _service.Get(id).Result; Assert.True(retorno != null); Assert.Equal("Arya", retorno.PrimeiroNome); Assert.Equal("Stark", retorno.UltimoNome); }
public async Task <IActionResult> Get(int id) { string sessionId = Guid.NewGuid().ToString(); try { _logger.LogInformation("[{0}][INFO]Wappa.Api.Controllers.MotoristaController.Get({1})" , sessionId, id); var result = await _service.Get(id); _logger.LogInformation("[{0}][INFO]Wappa.Api.Controllers.MotoristaController.Get({1}) {2}" , sessionId, id, JsonConvert.SerializeObject(result)); return(Ok(result)); } catch (Exception ex) { _logger.LogError("[{0}][ERROR]Wappa.Api.Controllers.MotoristaController.Get({1}) {2}" , sessionId, id, ex.Message); return(BadRequest(ex.Message)); } }