Beispiel #1
0
        public async Task DeveObterEnderecoAsync()
        {
            var endereco = await _viaCepService.ObterEnderecoAsync("01001000");

            Assert.NotNull(endereco);

            endereco = await _viaCepService.ObterEnderecoAsync("01001-000");

            Assert.NotNull(endereco);

            var enderecos = await _viaCepService.ObterEnderecosAsync(_enderecoRequisicao);

            Assert.NotNull(enderecos);
        }
        public async Task <ActionResult> Consultar(string cep)
        {
            if (string.IsNullOrEmpty(cep))
            {
                return(HttpNotFound());
            }
            var endereco = await _viaCepService.ObterEnderecoAsync(cep.Replace("-", ""));

            return(Json(endereco, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
 public async Task <Endereco> ComoEnderecoAsync()
 => await _viaCepService.ObterEnderecoAsync(_cep);