private TaxaDeJurosDto OnError(HttpResponseMessage responseMessage)
        {
            var dto = new TaxaDeJurosDto();

            dto.AddError(responseMessage.ToString());
            return(dto);
        }
        public async Task DeveRetornarATaxaDeJurosPadrao(string url)
        {
            var resultadoEsperado = new TaxaDeJurosDto()
            {
                Valor = TaxaDeJurosPadrao.ValorDaTaxa
            };
            var client = _factory.CreateClient();

            var response = await client.GetAsync(url);

            response.EnsureSuccessStatusCode();
            var xpto = await response.Content.ReadAsStringAsync();

            var resultado = JsonSerializer.Deserialize <TaxaDeJurosDto>(xpto);

            Assert.Equal(resultadoEsperado.Valor, resultado.Valor);
        }
        public override TaxaDeJurosDto GetValor(Guid id)
        {
            var dto = new TaxaDeJurosDto();

            if (_taxasDeJurosContext.TaxasDeJuros.Where(x => x is TaxaDeJurosEspecial).Any(x => x.Id == id))
            {
                dto.Valor = Factory.Create().Get();
                return(dto);
            }

            if (ProximoLink is null)
            {
                dto.AddError("O tipo de Taxa de Juros deve ser informado.");
                return(dto);
            }

            return(ProximoLink.GetValor(id));
        }
        public async Task <TaxaDeJurosDto> GetAsync()
        {
            var dto = new TaxaDeJurosDto
            {
                Valor       = 10,
                TaxaDeJuros = new TaxaDeJurosPadrao()
            };

            var client = GetClient();

            client.DefaultRequestHeaders.Accept.Clear();

            var jsonInString = JsonConvert.SerializeObject(dto);

            var postAsync = await client.PostAsync(Endpoint,
                                                   new StringContent(jsonInString, Encoding.UTF8, "application/json"));

            return(postAsync.IsSuccessStatusCode
                ? await OnSuccess(postAsync)
                : OnError(postAsync));
        }
        public decimal GetValorTaxaDeJuros()
        {
            var taxaDeJuros = new TaxaDeJurosDto();

            return(taxaDeJuros.GetTaxaDeJuros());
        }