Exemplo n.º 1
0
        public void ShouldHandleJsonErrorFromWeatherApi()
        {
            //Assume
            string content = GetStreamLines();
            WeatherForecastController weatherForecastController = InstantiateWeatherForecastController();

            //Act

            //Assert
            Assert.Throws <Exception>(() => weatherForecastController.ConvertResponseContentToWeatherForecasts(content));
        }
Exemplo n.º 2
0
        public void ConvertWeatherJSONToWeatherForecast()
        {
            // Assume
            //https://api.openweathermap.org/data/2.5/onecall?lat=45.75&lon=25.3333&exclude=hourly,minutely&appid=5e2f591282908129a5688c6af52aa490

            var content = GetStreamLines();
            WeatherForecastController weatherForecastController = InstantiateWeatherForecastController();
            // Act
            var             weatherForecasts          = weatherForecastController.ConvertResponseContentToWeatherForecasts(content);
            WeatherForecast weatherForcastForTomorrow = weatherForecasts[1];

            // Assert
            Assert.Equal(285.39, weatherForcastForTomorrow.TemperatureK);
        }