Exemplo n.º 1
0
        public async Task E_Possivel_Executar_Metodo_Update()
        {
            _serviceMock = new Mock <ICountryConsumerV2Service>();
            _serviceMock.Setup(m => m.Put(countryUpdateV2Dto)).ReturnsAsync(countryDtoResult);
            _service = _serviceMock.Object;

            var resultUpdate = await _service.Put(countryUpdateV2Dto);

            Assert.NotNull(resultUpdate);
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Put([FromBody] CountryUpdateV2Dto 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));
            }
        }