Beispiel #1
0
        public WeatherInfoModel GetCurrentWeatherByLocation(decimal latitude, decimal longitude)
        {
            var weatherService = new OpenWeatherMapWeatherService(_settings.KeyPath);
            var currentWeather = weatherService.GetCurrentWeatherByLocation(latitude, longitude);

            currentWeather.UnitType         = UnitType.Fahrenheit;
            currentWeather.Temperature      = currentWeather.Temperature * 9 / 5 - 459.67m;
            currentWeather.WeatherQueryTime = DateTime.Now;

            return(currentWeather);
        }
        public void CurrentWeather_ValidLocation_GetWeather()
        {
            // arrange
            var weatherService = new OpenWeatherMapWeatherService(_openWeatherMapKeyPath);

            // act
            var currentWeather = weatherService.GetCurrentWeatherByLocation(0, 0);

            // assert
            Assert.That(currentWeather.Temperature, Is.Not.EqualTo(0));
        }