public void CalculateDistance_LineCoordinate_ReturnsDistanceToEndPointIfPointIsOutsideLineSegment2()
        {
            Coordinate a = new Coordinate(0, 0);
            Coordinate b = new Coordinate(90, 0);
            Coordinate c = new Coordinate(5, 45);

            Sphere2DCalculator target = new Sphere2DCalculator();

            double distance         = target.CalculateDistance(c, a, b, LineMode.LineSegment);
            double expectedDistance = target.CalculateDistance(a, c);

            Assert.InRange <double>(distance, expectedDistance * 0.995, expectedDistance * 1.005);
        }
        public void CalculateDistance_CoordinateCoordinate_Returns0ForSameCoordinate()
        {
            Coordinate         c      = new Coordinate(10.1, 100.2);
            Sphere2DCalculator target = new Sphere2DCalculator();

            double distance = target.CalculateDistance(c, c);

            Assert.Equal(0, distance);
        }
        public void CalculateDsitance_CoordinateCoordinate_CalculateDistancesAcross180DegBoundary()
        {
            Coordinate         c1     = new Coordinate(-135, 0);
            Coordinate         c2     = new Coordinate(135, 0);
            Sphere2DCalculator target = new Sphere2DCalculator();

            double distance         = target.CalculateDistance(c1, c2);
            double expectedDistance = Math.PI * 2 * Sphere2DCalculator.EarthRadius / 4;

            Assert.InRange <double>(distance, expectedDistance * 0.995, expectedDistance * 1.005);
        }
        public void CalculateDistance_CoordinateCoordinate_ReturnsDistanceOf2Points()
        {
            Coordinate         c1     = new Coordinate(0, 0);
            Coordinate         c2     = new Coordinate(0, 90);
            Sphere2DCalculator target = new Sphere2DCalculator();

            double distance         = target.CalculateDistance(c1, c2);
            double expectedDistance = Math.PI * 2 * Sphere2DCalculator.EarthRadius / 4;

            Assert.InRange <double>(distance, expectedDistance * 0.995, expectedDistance * 1.005);
        }
        public void CalculateDistance_LineCoordinate_ReturnsDistanceToLineSegment()
        {
            Coordinate a = new Coordinate(0, 0);
            Coordinate b = new Coordinate(90, 0);
            Coordinate c = new Coordinate(45, 45);

            Sphere2DCalculator target = new Sphere2DCalculator();

            double distance         = target.CalculateDistance(c, a, b, LineMode.LineSegment);
            double expectedDistance = Math.PI * 2 * Sphere2DCalculator.EarthRadius / 8;

            Assert.InRange <double>(distance, expectedDistance * 0.995, expectedDistance * 1.005);
        }