private void GetData(object sender, RoutedEventArgs e)
        {
            //get data for given location
            string loc = locTxtBox.Text.ToString();
            try
            {
                if (!String.IsNullOrEmpty(loc))
                {
                    Location location = new Location(loc);
                    IWeatherDataService service = WeatherDataService.Instance;
                    WeatherData data = service.GetWeatherData(location);

                    line1Lbl.Content = String.Format("Location: {0}, {1}", data.Location.CityName, data.Location.Country);
                    line2Lbl.Content = String.Format("Last Update: {0}", data.LastUpdate.ToString());
                    line3Lbl.Content = String.Format("Temperature: {0} {1}, humidity: {2}{3}",
                        data.Temperature.AverageTemperature, data.Temperature.TemperatureUnit, data.HumidityValue, data.HumidityUnit);
                    line4Lbl.Content = String.Format("Pressure: {0} {1}",
                        data.PressureValue, data.PressureUnit);
                    line5Lbl.Content = String.Format("Wind speed {0} {1}, direction: {2}",
                        data.Wind.Speed, data.Wind.SpeedDescription, data.Wind.Direction);

                }
            }
            catch (WeatherDataServiceException)
            {
                MessageBoxResult result = MessageBox.Show(
                    String.Format("Provided location: \"{0}\" is invalid. Please try again!", loc),
                        "Error", MessageBoxButton.OK, MessageBoxImage.Question);

            }
        }
        static void Main(string[] args)
        {
            Location location = new Location("Tel Aviv");
            IWeatherDataService service = WeatherDataService.Instance;
            WeatherData data = service.GetWeatherData(location);
            Console.WriteLine(data.ToString());

            Console.ReadKey();
        }
        public void GetWeatherDataTest_ExceptionThrownOnWrongWeatherDataType_Negative()
        {
            const string WRONG_DATA_TYPE = "WrongWeatherType";

            Location location = new Location(2172797);

            WeatherDataServiceFactory factory = new WeatherDataServiceFactory();

            IWeatherDataService service
                = factory.getWeatherDataService(WRONG_DATA_TYPE);
        }
        public void GetWeatherDataTest_ValidDataObjectReturned_Positive()
        {
            Location location = new Location(2172797);

            WeatherDataServiceFactory factory = new WeatherDataServiceFactory();

            IWeatherDataService service
                = factory.getWeatherDataService(WeatherDataServiceFactory.OPEN_WEATHER_MAP);

            WeatherData data = service.GetWeatherData(location);

            Assert.IsNotNull(data);
        }