public async Task <double> Get(string origin, string destination) { var originCode = new IataAirportCode(origin); var destinationCode = new IataAirportCode(destination); return(await _distanceCalculator.DistanceBetween(originCode, destinationCode)); }
public async Task Should_CalculateDistance() { // Arrange var orig = new IataAirportCode("ORG"); var dest = new IataAirportCode("DST"); var origCoordinate = new Coordinate(0, 0); var destCoordinate = new Coordinate(0, 1); _locationProviderMock.Setup(_ => _.LocationOf(orig)).Returns(Task.FromResult(origCoordinate)); _locationProviderMock.Setup(_ => _.LocationOf(dest)).Returns(Task.FromResult(destCoordinate)); // Act var result = await _calculator.DistanceBetween(orig, dest); // Assert Assert.AreEqual(111.2d, result); }