public void Check_HD75HY_With_HD75HY_ShouldBe_0() { var start = new Coordinate(53.617699485619916, -1.8890033797334795); var end = new Coordinate(53.617699485619916, -1.8890033797334795); var distance = CoordinateDistanceChecker.Check(start, end); distance.ShouldBe(0); }
public void Check_HD75HY_With_HD74EZ_ShouldBe_1770m() { var start = new Coordinate(53.617699485619916, -1.8890033797334795); var end = new Coordinate(53.62771821593212, -1.8681711951473778); var distance = CoordinateDistanceChecker.Check(start, end); distance.ShouldBe(1770); }
public void Check_HD75HY_With_HD75HY_ShouldBe_Equal() { var start = new Coordinate(53.617699485619916, -1.8890033797334795); var end = new Coordinate(53.617699485619916, -1.8890033797334795); var distance = CoordinateDistanceChecker.Check(start, end); start.Equals(end).ShouldBeTrue(); }
public async Task <int> GetDistance(string riskPostCode, string keptPostCode) { var result = 0; var key = new KeyValuePair <string, string>(riskPostCode, keptPostCode); if (_cache.TryGetValue(key, out result)) { return(result); } _start = await GetCoordinates(riskPostCode); _end = await GetCoordinates(keptPostCode); var distance = CoordinateDistanceChecker.Check(_start, _end); _cache.Set(key, distance, _cacheOptions); return(distance); }