public void TestGetProximityBadOrigin() { var address = new AddressDTO { AddressLine1 = "3500 Madison Rd", City = "Cincinnati", State = "OH", PostalCode = "45209", Latitude = 39.15946159999999, Longitude = -84.42336390000003 }; var result = _fixture.GetProximity("1234 test st, testy mctestface, te, 99999-9999, xyz", new List <AddressDTO> { address }); Assert.IsNotNull(result); Assert.AreEqual(1, result.Count); Assert.IsNull(result[0]); }
public void TestGetProximityFor100Addresses() { var mapsApiClient = new Mock <IMapsAPIClient>(MockBehavior.Strict); _fixture = new GoogleMapsDistanceMatrixAddressProximityService(mapsApiClient.Object, _addressGeocodingService); var elements = new List <DistanceMatrixRowElement>(); for (var i = 0; i < 100; i++) { elements.Add(new DistanceMatrixRowElement { Distance = new Duration { Value = 9000 + i }, Status = "OK" }); } var response = new GetDistanceMatrixResponse { Rows = new List <DistanceMatrixRow> { new DistanceMatrixRow { Elements = elements } } }; var addresses = new List <string>(); for (var i = 0; i < 100; i++) { addresses.Add($"{900 + i} Reading Rd, Mason, OH 45040"); } mapsApiClient.Setup(mocked => mocked.APIGet("/maps/api/distancematrix/json", It.IsAny <QueryParams>(), It.IsAny <Func <HttpWebResponse, GetDistanceMatrixResponse> >(), It.IsAny <DateTime?>(), 0, It.IsAny <string>(), true, null, true, null)).Returns(response); var result = _fixture.GetProximity("990 Reading Rd, Mason, OH 45040", addresses); mapsApiClient.Verify(mocked => mocked.APIGet("/maps/api/distancematrix/json", It.IsAny <QueryParams>(), It.IsAny <Func <HttpWebResponse, GetDistanceMatrixResponse> >(), It.IsAny <DateTime?>(), 0, It.IsAny <string>(), true, null, true, null), Times.Once); Assert.AreEqual(100, result.Count); }