public void RequestLimitsAreUpdatedAfterEachRequest() { PostcodeApiClient client = new PostcodeApiClient(_apiKey); client.GetAddressInfo("0268200000075156"); int?remaining = client.RequestsRemaining; int?limit = client.RequestDayLimit; Assert.IsNotNull(remaining, "Calls remaining: {0}", remaining); Assert.IsNotNull(limit, "Max calls: {0}", limit); client.GetAddressInfo("0268200000075156"); Assert.IsTrue(client.RequestsRemaining < remaining, "Calls remaining (after query): {0}", client.RequestsRemaining); Assert.AreEqual(limit, client.RequestDayLimit); }
public void RequestsLimitsAreFilled() { PostcodeApiClient client = new PostcodeApiClient(_apiKey); Assert.IsNull(client.RequestDayLimit); Assert.IsNull(client.RequestsRemaining); client.GetAddressInfo("0268200000075156"); Assert.IsNotNull(client.RequestDayLimit); Assert.IsNotNull(client.RequestsRemaining); }
public void GetSingleAddress() { PostcodeApiClient client = new PostcodeApiClient(ApiKey); Address address = client.GetAddressInfo("0268200000075156"); Assert.IsNotNull(address); Assert.IsNotNull(address.Geo.GeographicCenter); Assert.IsNotNull(address.Geo.GeographicExterior); Assert.AreEqual(1, address.Geo.GeographicExterior.WGSCoordinates.Coordinates.Count); Assert.AreEqual(5, address.Geo.GeographicExterior.WGSCoordinates.Coordinates[0].Count); Assert.AreEqual(2, address.Geo.GeographicExterior.WGSCoordinates.Coordinates[0][1].Count); }