private WeatherUndergroundModel GetWeatherUndergroundModel() { var model = new WeatherUndergroundModel(); model.Current_Observation = new CurrentObservation(); model.Current_Observation.Icon = "Numb"; model.Current_Observation.Icon_Url = "Numb"; model.Current_Observation.Observation_Epoch = 1111111; model.Current_Observation.Temp_C = 17; model.Current_Observation.Temp_F = 63; model.Current_Observation.Weather = "Sunny"; model.Forecast = new Forecast(); model.Forecast.SimpleForecast = new SimpleForecast(); model.Forecast.SimpleForecast.ForecastDay = new List <WeatherUndergroundDay>(); var weatherUndergroundDay = new WeatherUndergroundDay(); weatherUndergroundDay.Conditions = "Sunny"; weatherUndergroundDay.Date = new WeatherUndergroundDate(); weatherUndergroundDay.Date.Epoch = 1111111; weatherUndergroundDay.High = new High(); weatherUndergroundDay.High.Celsius = 21; weatherUndergroundDay.High.Fahrenheit = 74; weatherUndergroundDay.Low = new Low(); weatherUndergroundDay.Low.Celsius = 14; weatherUndergroundDay.Low.Fahrenheit = 43; weatherUndergroundDay.Icon = "Numb"; weatherUndergroundDay.Icon_Url = "Numb"; model.Forecast.SimpleForecast.ForecastDay.Add(weatherUndergroundDay); return(model); }
public WeatherDashboardModel Map(WeatherUndergroundModel model) { var dashboardModel = new WeatherDashboardModel(); dashboardModel.CurrentCelsius = model.Current_Observation.Temp_C; dashboardModel.CurrentFahrenheit = model.Current_Observation.Temp_F; dashboardModel.CurrentSummary = model.Current_Observation.Weather; dashboardModel.Icon = model.Current_Observation.Icon; dashboardModel.IconUrl = model.Current_Observation.Icon_Url; dashboardModel.Forecast = new List <DayDashboard>(); foreach (var day in model.Forecast.SimpleForecast.ForecastDay.Take(int.Parse(settingsManager.Get(Constants.FORECAST_DEFAULT_SIZE)))) { var dayDashboard = new DayDashboard(); dayDashboard.Summary = day.Conditions; dayDashboard.LowCelsius = day.Low.Celsius; dayDashboard.LowFahrenheit = day.Low.Fahrenheit; dayDashboard.HighCelsius = day.High.Celsius; dayDashboard.HighFahrenheit = day.High.Fahrenheit; dayDashboard.Icon = day.Icon; dayDashboard.IconUrl = day.Icon_Url; dayDashboard.Date = new DateTime(1970, 1, 1).AddSeconds(day.Date.Epoch); dashboardModel.Forecast.Add(dayDashboard); } return(dashboardModel); }
public void Initialize() { settingsManager = new Mock <ISettingsManager>(); model = GetWeatherUndergroundModel(); }