public async Task E_Possivel_Executar_Metodo_Update() { _serviceMock = new Mock <ICountryConsumerService>(); _serviceMock.Setup(m => m.Put(countryUpdateDto)).ReturnsAsync(countryDtoResult); _service = _serviceMock.Object; var resultUpdate = await _service.Put(countryUpdateDto); Assert.NotNull(resultUpdate); }
public async Task <ActionResult> Put([FromBody] CountryUpdateDto dto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var result = await _service.Put(dto); if (result != null) { return(Ok(result)); } else { return(BadRequest()); } } catch (ArgumentException e) { return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message)); } }