public WeatherStatics Get_weatherStaticsrNow(string postCode, string country) { WeatherStatics weatherStatics = new WeatherStatics(); weatherStatics.Add(new WeatherData(RestWeatherForcastUtil.GetDataFromUrlByZipCode(postCode, country).Result)); return(weatherStatics); }
public void AddTest() { WeatherStatics weatherStatics = new WeatherStatics(); weatherStatics.Add(new WeatherData(RestWeatherForcastUtil.GetDataFromUrlByZipCode("9000", "BE").Result)); Assert.AreEqual(1, weatherStatics.AllWeatherDatas().Count); }
public void GetWeatherBulkNowTest() { WeatherWebRetrieverService webRetrieverService = new WeatherWebRetrieverService(); WeatherStatics statics = webRetrieverService.GetWeatherBulkNow(CityRepo.Cities().Take(5).ToList(), "BE"); // statics.CreateReport(); Assert.AreEqual(4, statics.AllWeatherDatas().Count); }
public void GetMinTest() { WeatherStatics weatherStatics = new WeatherStatics(); foreach (var data in GetDatas()) { weatherStatics.Add(data); } Assert.AreEqual(8, weatherStatics.AllWeatherDatas().Count); Assert.AreEqual(12.5, weatherStatics.GetMin("Ghent").Temperature); }
public void GetAverageTestAll() { WeatherStatics weatherStatics = new WeatherStatics(); foreach (var data in GetDatas()) { weatherStatics.Add(data); } Assert.AreEqual(8, weatherStatics.AllWeatherDatas().Count); Assert.AreEqual(13.0625, weatherStatics.GetAverage()); }
public void GetMaxTempAllTest() { WeatherStatics weatherStatics = new WeatherStatics(); foreach (var data in GetDatas()) { weatherStatics.Add(data); } Assert.AreEqual(8, weatherStatics.AllWeatherDatas().Count); Assert.AreEqual(15.5, weatherStatics.GetMaxTemp()); }
public WeatherStatics GetWeatherStatics() { var bs = _collection.Find(new BsonDocument()).ToList(); WeatherStatics statics = new WeatherStatics(); foreach (var sData in bs) { statics.Add(sData); } return(statics); }
public WeatherStatics GetWeatherBulkNow(List <string> datas, string country) { WeatherStatics weatherStatics = new WeatherStatics(); foreach (var dataCity in datas) { var dataFromUrlByZipCode = RestWeatherForcastUtil.GetDataFromUrlByZipCode(dataCity, country).Result; if (dataFromUrlByZipCode != null) { weatherStatics.Add(new WeatherData(dataFromUrlByZipCode)); } } return(weatherStatics); }
public void AddBulkTest() { WeatherStatics weatherStatics = new WeatherStatics(); foreach (var city in CityRepo.Cities().Take(5)) { Current current = RestWeatherForcastUtil.GetDataFromUrlByZipCode(city, "BE").Result; if (current != null) { weatherStatics.Add(new WeatherData(current)); } } Assert.AreEqual(4, weatherStatics.AllWeatherDatas().Count); }
public static void CreateReport(this WeatherStatics weather) { creator.CreateReport(new CurrentWeatherFromAllCity(weather)); }
private WeatherStatics GetDatas() { List <WeatherData> datas = new List <WeatherData>() { new WeatherData() { Country = "BE", Temperature = 12.5, Speed = 10.2, City = "Ghent", Pressure = 12, WindSpeed = 5, Id = Guid.NewGuid(), Humidty = 5, WindDirection = "NE", UpdateWeather = DateTime.Now }, new WeatherData() { Country = "BE", Temperature = 12.5, Speed = 10.2, City = "Ghent", Pressure = 12, WindSpeed = 5, Id = Guid.NewGuid(), Humidty = 5, WindDirection = "NE", UpdateWeather = DateTime.Now.AddHours(5) }, new WeatherData() { Country = "BE", Temperature = 13, Speed = 10.2, City = "Ghent", Pressure = 12, WindSpeed = 5, Id = Guid.NewGuid(), Humidty = 5, WindDirection = "NE", UpdateWeather = DateTime.Now.AddHours(6) }, new WeatherData() { Country = "BE", Temperature = 14, Speed = 10.2, City = "Ghent", Pressure = 12, WindSpeed = 5, Id = Guid.NewGuid(), Humidty = 5, WindDirection = "NE", UpdateWeather = DateTime.Now.AddHours(7) }, new WeatherData() { Country = "BE", Temperature = 12, Speed = 10.2, City = "Ostend", Pressure = 12, WindSpeed = 5, Id = Guid.NewGuid(), Humidty = 5, WindDirection = "NE", UpdateWeather = DateTime.Now.AddHours(1) }, new WeatherData() { Country = "BE", Temperature = 12.5, Speed = 10.2, City = "Ostend", Pressure = 12, WindSpeed = 5, Id = Guid.NewGuid(), Humidty = 5, WindDirection = "NE", UpdateWeather = DateTime.Now.AddHours(2) } , new WeatherData() { Country = "BE", Temperature = 15.5, Speed = 10.2, City = "Ostend", Pressure = 12, WindSpeed = 5, Id = Guid.NewGuid(), Humidty = 5, WindDirection = "NE", UpdateWeather = DateTime.Now.AddHours(3) } , new WeatherData() { Country = "BE", Temperature = 12.5, Speed = 10.2, City = "Ostend", Pressure = 12, WindSpeed = 5, Id = Guid.NewGuid(), Humidty = 5, WindDirection = "NE", UpdateWeather = DateTime.Now.AddHours(4) } }; WeatherStatics weatherStatics = new WeatherStatics(); foreach (var variable in datas) { weatherStatics.Add(variable); } return(weatherStatics); }
public CurrentWeatherFromAllCity(WeatherStatics weatherData) { this._weatherData = weatherData; base.WeatherReport = this; }