コード例 #1
0
        public void CalculateDistance_ReturnsCorrectDistanceBetweenTwoPoints(double point1Lat, double point1Long, double point2Lat, double point2Long, double expectedDistanceBetweenPoints)
        {
            // Arrange
            var point1 = new double[] { point1Lat, point1Long };
            var point2 = new double[] { point2Lat, point2Long };

            // Act
            var actualDistance = DistanceMetrics.CalculateDistance(point1, point2);

            // Assert
            actualDistance.Should().Be(expectedDistanceBetweenPoints);
        }
コード例 #2
0
        /// <summary>
        /// Calculates the distance between this location and another one, in meters.
        /// </summary>
        public double CalculateDistance(Location location)
        {
            var point1 = new[]
            {
                this.Latitude,
                this.Longitude
            };

            var point2 = new[]
            {
                location.Latitude,
                location.Longitude
            };

            return(DistanceMetrics.CalculateDistance(point1, point2));
        }