public async Task Should_Not_Update_Taxpayer_When_They_Are_Not_In_The_Database()
        {
            var taxpayer = new Taxpayer {
                Name = "Updated", NumberOfDependents = 0, MonthlyGrossIncome = 2000, CPF = 22222222222
            };

            var result = await _taxpayerService.UpdateAsync(2, taxpayer);

            Assert.IsFalse(result.Success);
            Assert.AreEqual("Contribuinte não encontrado na base de dados para atualização.", result.Message);
        }
        public async Task <IActionResult> UpdateAsync(int id, [FromBody] SaveTaxpayerResource saveTaxpayerResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var taxpayer = _mapper.Map <SaveTaxpayerResource, Taxpayer>(saveTaxpayerResource);
            var response = await _taxpayerService.UpdateAsync(id, taxpayer);

            if (!response.Success)
            {
                return(BadRequest(response.Message));
            }

            var resource = _mapper.Map <Taxpayer, TaxpayerResource>(response.Taxpayer);

            return(Ok(resource));
        }