public WeatherReport GetWeatherReportTest() { Weather currentWeather = new Weather { TemperatureFarenheit = 98.6, ConditionsDescription = "Hot and Sunny" }; Forecast forecast1 = new Forecast { ForecastDate = DateTime.Parse("11-01-2015"), ForecastWeather = new Weather { TemperatureFarenheit = 88.6, ConditionsDescription = "Warm and Rainy" } }; Forecast forecast2 = new Forecast { ForecastDate = DateTime.Parse("11-02-2015"), ForecastWeather = new Weather { TemperatureFarenheit = 78.6, ConditionsDescription = "Beautiful Day" } }; Forecast forecast3 = new Forecast { ForecastDate = DateTime.Parse("11-03-2015"), ForecastWeather = new Weather { TemperatureFarenheit = 68.6, ConditionsDescription = "Cool and Breezy" } }; List<Forecast> forecastList = new List<Forecast>(); forecastList.Add(forecast1); forecastList.Add(forecast2); forecastList.Add(forecast3); WeatherReport LatestWeatherReport = new WeatherReport { CurrentWeather = currentWeather, FutureWeather = forecastList }; return LatestWeatherReport; }
public Weather WeatherDataMapper(JObject jsonObject, string conditionsDescriptionFieldName, string temperatureFarenheitFieldName1, string temperatureFarenheitFieldName2) { string conditionsDescription = FieldMapperString(jsonObject, conditionsDescriptionFieldName); double temperatureFarenheit = FieldMapperDouble(jsonObject, temperatureFarenheitFieldName1, temperatureFarenheitFieldName2); Weather weather = new Weather(); weather.ConditionsDescription = conditionsDescription; weather.TemperatureFarenheit = temperatureFarenheit; return weather; }