Пример #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;

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

            // act
            var historicalWeather = weatherService.GetHistoricalWeatherByLocation(0, 0);

            // assert
            Assert.Fail("Should have thrown an exception.");
        }
        public void ForecastWeather_ValidLocation_GetWeather()
        {
            // arrange 
            var weatherService = new OpenWeatherMapWeatherService(_openWeatherMapKeyPath);

            // act
            var forecastWeather = weatherService.GetForecastWeatherByLocation(0, 0);

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