public float GetDistanceFromCity(Address destinationAddress) { var distanceFromCity = 0.0f; var distanceFinder = new DistanceFinder(); var url = string.Empty; try { url = distanceFinder.GetUrl(startingAddress, destinationAddress); } catch (ArgumentNullException) { // part of the address was not supplied distanceFromCity = 0.0f; } catch (Exception) { throw; } if (!string.IsNullOrEmpty(url)) { var response = distanceFinder.GetWebResponse(url); distanceFromCity = distanceFinder.GetDistance(response); } return(distanceFromCity); }
public void GetDistance_DistanceReturned_Test() { // Arrange var expectedDistance = 18.0f; // Act var actualDistance = testDistanceFinder.GetDistance(testDistanceResponse); // Assert Assert.AreEqual(expectedDistance, actualDistance); }