Esempio n. 1
0
        public void When_calculating_earth_projection_pythagoras_then_return_the_expected_result_accordingly(
            double latitudeA, double longitudeA, double latitudeB, double longitudeB, MeasuringUnit measuringUnit, double expectedResult)
        {
            var result = _sut.CalculateEarthProjectionPythagoras(latitudeA, longitudeA, latitudeB, longitudeB, measuringUnit);

            Assert.Equal(expectedResult, result);
        }
Esempio n. 2
0
        public ActionResult <double> CalculateEarthProjectionPythagoras(double latitudeA, double longitudeA, double latitudeB, double longitudeB, string measuringUnit)
        {
            try
            {
                _logger.LogInformation($"Calculating Earth Projection Pythagoras between {latitudeA}, {longitudeA} and {latitudeB}, {longitudeB}.");

                var distance = _geoLocationCalculator
                               .CalculateEarthProjectionPythagoras(latitudeA, longitudeA, latitudeB, longitudeB, GetMeasuringUnitEnum(measuringUnit));

                return(Ok(distance));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Something went wrong calculating Earth Projection Pythagoras: {ex}");
            }

            return(BadRequest());
        }