public void TestGetTemperature() { double celsius = 15.5; weatherdata = service.getWeatherData(new Location("london")); Assert.AreEqual(celsius, weatherdata.GetTemperature(), delta: 30); }
public void getWeatherDataTest() { Location location = new Location("London"); IWeatherDataService service = WeatherDataServiceFactory.getWeatherDataService(WeatherDataServiceFactory.OPEN_WEATHER_MAP); WeatherData weatherData = service.getWeatherData(new Location("London")); Assert.AreEqual(weatherData.Location.City, location.City); }
static void Main(string[] args) { IWeatherDataService service = WeatherDataServiceFactory.getWeatherDataService( WeatherDataServiceFactory.WORLD_WEATHER_ONLINE); WeatherData wd = service.getWeatherData(new Location("London")); wd.PrintAllDetails(); }
static void Main(string[] args) { Location newlocation = new Location("Israel"); IWeatherDataService open_map_weather = WeatherDataServiceFactory.getWeatherDataService(WeatherDataServiceFactory.OPEN_WEATHER_MAP); WeatherData opachki = open_map_weather.getWeatherData(newlocation); opachki.printAllCached(); Console.WriteLine(" Max temp " + opachki.max_temperatur + " Min temp " + opachki.min_temperatur + " temp " + opachki.value_temperatur); }
/// <summary> /// Starting application /// </summary> /// <param name="args"></param> static void Main(string[] args) { Location[] myLocation = { new Location("uk", "london"), new Location("il", "telaviv") }; //create locations IWeatherDataService service = WeatherDataServiceFactory.getWeatherDataService(WeatherDataServiceFactory.Service.OPEN_WEATHER_MAP); //get instance for (int i = 0; i < myLocation.Length; i++) { Console.WriteLine(service.getWeatherData(myLocation[i]));//print } }
public delegate void AnonymousPrint(ref IWeatherDataService service1);//Anonymous Method public static void Main(string[] args) { try { IWeatherDataService Service = WeatherDataServiceFactory.getWeatherDataService(WeatherDataServiceFactory.OPEN_WEATHER_MAP); WeatherData weatherData = Service.getWeatherData(new Location("Haifa")); AnonymousPrint DisplayServiceName = delegate(ref IWeatherDataService CurrentService) { Console.WriteLine("Information Was Received From: " + CurrentService.ToString()); }; weatherData.PrintToScreen(); DisplayServiceName(ref Service); } catch (WeatherDataException w) { Console.WriteLine(w.ToString()); } finally { Console.ReadKey(); } }
static void Main(string[] args) { Location newlocation = new Location("london"); IWeatherDataService open_map_weather = WeatherDataServiceFactory.getWeatherDataService(WeatherDataServiceFactory.OPEN_WEATHER_MAP); WeatherData opachki = open_map_weather.getWeatherData(newlocation); }