/// <summary> /// The entry point for the application. /// </summary> static void Main(string[] args) { try { IWeatherDataService n = new WeatherDataServiceFactory().GetWeatherDataService(1); WeatherData wd = n.GetWeatherData(new Location("Haifa", "il")); //getting weather data by location - Haifa, IL if (wd != null) { Console.WriteLine(wd + "\n"); } wd = n.GetWeatherData(524901); //getting weather data by city id - Moscow, RU if (wd != null) { Console.WriteLine(wd + "\n"); } wd = n.GetWeatherData(new GeoCoordinations(35, 139)); //getting weather data by geographic coordinations - Shuzenji, JP if (wd != null) { Console.WriteLine(wd + "\n"); } } catch (WeatherDataServiceException e) { Console.WriteLine("Excption cought:\n" + e.ToString()); } }
public void GetWeatherDataIdTest() { IWeatherDataService n = new WeatherDataServiceFactory().GetWeatherDataService(1); WeatherData target = n.GetWeatherData(524901); WeatherData wd = GetWeatherDataForTest("http://api.openweathermap.org/data/2.5/forecast?id=524901&mode=xml"); //compare the two WeatherData objects Assert.IsTrue(wd.Equals(target)); }
public void GetWeatherDataGeoTest() { IWeatherDataService n = new WeatherDataServiceFactory().GetWeatherDataService(1); WeatherData target = n.GetWeatherData(new GeoCoordinations(35, 139)); WeatherData wd = GetWeatherDataForTest("http://api.openweathermap.org/data/2.5/forecast?lat=35&lon=139&mode=xml"); //compare the two WeatherData objects Assert.IsTrue(wd.Equals(target)); }
/// <summary> /// The entry point for the application. /// </summary> static void Main(string[] args) { try { IWeatherDataService n = new WeatherDataServiceFactory().GetWeatherDataService(1); WeatherData wd = n.GetWeatherData(new Location("Haifa", "il")); //getting weather data by location - Haifa, IL if(wd != null) Console.WriteLine(wd + "\n"); wd = n.GetWeatherData(524901); //getting weather data by city id - Moscow, RU if (wd != null) Console.WriteLine(wd + "\n"); wd = n.GetWeatherData(new GeoCoordinations(35, 139)); //getting weather data by geographic coordinations - Shuzenji, JP if (wd != null) Console.WriteLine(wd + "\n"); } catch(WeatherDataServiceException e) { Console.WriteLine("Excption cought:\n" + e.ToString()); } }
public void GetWeatherDataLocTest() { IWeatherDataService n = new WeatherDataServiceFactory().GetWeatherDataService(1); WeatherData target = n.GetWeatherData(new Location("Haifa","il")); WeatherData wd = GetWeatherDataForTest("http://api.openweathermap.org/data/2.5/forecast?q=haifa,il&mode=xml"); //compare the two WeatherData objects Assert.IsTrue(wd.Equals(target)); }
public void GetWeatherDataLocNullTest() { IWeatherDataService n = new WeatherDataServiceFactory().GetWeatherDataService(1); WeatherData target = n.GetWeatherData(new Location("0000000", "")); Assert.IsNull(target); }
public void GetWeatherDataIdNullTest() { IWeatherDataService n = new WeatherDataServiceFactory().GetWeatherDataService(1); WeatherData target = n.GetWeatherData(0000000); Assert.IsNull(target); }
public void GetWeatherDataGeoNullTest() { IWeatherDataService n = new WeatherDataServiceFactory().GetWeatherDataService(1); WeatherData target = n.GetWeatherData(new GeoCoordinations(10000000, 10000000)); Assert.IsNull(target); }