public void GetSingleAddress() { ApiResultWrapper address = _client.GetAddress("1446WP", 104); Assert.IsNotNull(address); Assert.IsNotNull(address.Resource); Assert.IsNotNull(address.Resource.BAG); }
public void GetSingleAddress() { ApiResultWrapper address = _client.GetAddress("6545CA", 29); Assert.IsNotNull(address); Assert.IsNotNull(address.Resource); Assert.IsNotNull(address.Resource.Bag); }
public void GetLargeAddressRange() { PostcodeApiClient client = new PostcodeApiClient(ApiKey); ApiHalResultWrapper result = client.GetAddress("1097JR"); Assert.IsNotNull(result); Assert.IsNotNull(result.Links.Self); Assert.IsNotNull(result.Links.Next); Assert.IsTrue(result.Embedded.Addresses.Count == 20); Assert.AreEqual("Pierre Lallementstraat", result.Embedded.Addresses[0].Street); Assert.AreEqual("Amsterdam", result.Embedded.Addresses[0].City.Label); }
public void GetAddressRange() { PostcodeApiClient client = new PostcodeApiClient(ApiKey); ApiHalResultWrapper result = client.GetAddress("1446WP"); Assert.IsNotNull(result); Assert.IsNotNull(result.Links.Self); Assert.IsNull(result.Links.Next); Assert.IsTrue(result.Embedded.Addresses.Count > 1); Assert.AreEqual("Component", result.Embedded.Addresses[0].Street); Assert.AreEqual("Purmerend", result.Embedded.Addresses[0].City.Label); }
public void GetSpecificAddress() { PostcodeApiClient client = new PostcodeApiClient(ApiKey); ApiHalResultWrapper result = client.GetAddress("1446WP", 106); Assert.IsNotNull(result); Assert.IsNotNull(result.Links.Self); Assert.AreEqual(1, result.Embedded.Addresses.Count); Assert.AreEqual("Component", result.Embedded.Addresses[0].Street); Assert.AreEqual("Purmerend", result.Embedded.Addresses[0].City.Label); Assert.AreEqual(1997, result.Embedded.Addresses[0].Year); Assert.AreEqual(682, result.Embedded.Addresses[0].SurfaceArea); }
public IActionResult FetchAddress([FromBody] PostcodeApiRequestModel model) { PostcodeApiClient client = new PostcodeApiClient(Config["PostcodeAPI:Key"]); try { ApiHalResultWrapper result = client.GetAddress(model.Zip, int.Parse(model.Number)); PostcodeAPI.Model.Address address = result.Embedded.Addresses[0]; AddressResponse response = new AddressResponse { City = address.City.ToString(), Street = address.Street, Province = address.Province.ToString() }; return(Ok(new { response })); } catch (ArgumentException) { return(BadRequest()); } }
public IActionResult PostCodeApi(string postcode, int huisnummer) { ApiHalResultWrapper result = _postcodeApiClient.GetAddress(postcode, huisnummer); return(Json(result)); }
public void GetSingleAddress() { AddressView result = _client.GetAddress("0268200000075156"); Assert.IsNotNull(result); }