public void openWeatherMapTest() { IWeatherDataService ServiceTest1 = WeatherDataServiceFactory.openWeatherMap(); IWeatherDataService ServiceTest2 = WeatherDataServiceFactory.openWeatherMap(); Assert.AreEqual(ServiceTest1.GetHashCode(), ServiceTest2.GetHashCode()); }
public void GetWeatherDataTest() { IWeatherDataService service = WeatherDataServiceFactory.GetWeatherDataService( WeatherDataServiceFactory.WeatherDataKind.OPEN_WEATHER_MAP); Location location = new Location("Hod Hasharon", "IL"); WeatherData data = null; try { data = service.GetWeatherData(location); } catch (WeatherDataServiceException) { Assert.Fail(); } Assert.IsNotNull(data); Assert.IsNotNull(data.Location); Assert.IsNotNull(data.Clouds); Assert.IsNotNull(data.Humidity); Assert.IsNotNull(data.Pressure); Assert.IsNotNull(data.Temperature); Assert.IsNotNull(data.Wind); Assert.IsNotNull(data.TimeSpan); }
static void Main(string[] args) { IWeatherDataService service = WeatherDataServiceFactory. GetWeatherDataService(WeatherDataServiceFactory.WeatherDataServiceSource.OPEN_WEATHER_MAP); var data = service.GetWeatherData(new Location("London", "uk")); }
public void GetWeatherDataTest() { Location location = new Location("aaaaaaaaaaaaaaaaaaa"); IWeatherDataService service = OpenWeatherMap.Instance; Assert.AreNotEqual(null, service.GetWeatherData(location)); }
public void GetWeatherDataServiceTest() { IWeatherDataService ServiceTest1 = WeatherDataServiceFactory.GetWeatherDataService(WeatherDataServiceFactory.OPEN_WEATHER_MAP); IWeatherDataService ServiceTest2 = WeatherDataServiceFactory.GetWeatherDataService(WeatherDataServiceFactory.OPEN_WEATHER_MAP); Assert.AreEqual(ServiceTest1.GetHashCode(), ServiceTest2.GetHashCode()); }
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); } }
public void GetWeatherDataTest() { Location location = new Location("Vladivostok"); IWeatherDataService service = OpenWeatherMap.Instance; Assert.IsNotNull(service.GetWeatherData(location)); }
static void Main(string[] args) { //testing the program Location location; string nameOfCity; IWeatherDataService service = WeatherDataServiceFactory.GetWeatherDataService(WeatherDataServiceFactory.OPEN_WEATHER_MAP); for (;;) { Console.WriteLine("x.For exit."); Console.Write("Please enter the name of city: "); nameOfCity = Console.ReadLine(); if (nameOfCity == "x") { return; } location = new Location(nameOfCity); try { WeatherData testWeather = service.GetWeatherData(location); //place Console.WriteLine("\nPlace: " + testWeather.City.Name + ", " + testWeather.City.Country + " (" + testWeather.City.Coord.Lon + ", " + testWeather.City.Coord.Lat + ")"); //temprature Console.WriteLine("Temp: " + testWeather.Temprature.Value + " (min " + testWeather.Temprature.Min + ", max " + testWeather.Temprature.Max + ") " + testWeather.Temprature.Unit); //huidity Console.WriteLine("Humidity: " + testWeather.Humidity.Value + " " + testWeather.Humidity.Unit); //pressure Console.WriteLine("Pressure: " + testWeather.Pressure.Value + " " + testWeather.Pressure.Unit); //wind Console.WriteLine("Wind: " + testWeather.Wind.Speed.Name + " " + testWeather.Wind.Speed.Value); //precipitation Console.WriteLine("Precipitation: " + testWeather.PrecipitationMode); //weather Console.WriteLine("Weather: " + testWeather.WeatherValue); //weather Console.WriteLine("Last Update: " + testWeather.LastUpdateValue.ToLongTimeString()); } catch (WeatherDataServiceException e) { Console.WriteLine(e); } Console.WriteLine("\nPress any key to continue...\n"); Console.ReadKey(); } }
static void Main(string[] args) { IWeatherDataService service = WeatherDataServiceFactory.getWeatherDataService( WeatherDataServiceFactory.WORLD_WEATHER_ONLINE); WeatherData wd = service.getWeatherData(new Location("London")); wd.PrintAllDetails(); }
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); }
public GetSongsByTemperatureOfCoordinatesQueryHandler(IMapper mapper, ISpotifyDataService spotifyDataService, IWeatherDataService weatherDataService) { _mapper = mapper; _spotifyDataService = spotifyDataService; _weatherDataService = weatherDataService; }
public void FirstCharToUpperTest() { WeatherDataServiceFactory wdf = new WeatherDataServiceFactory(); IWeatherDataService iwds = wdf.GetWeatherDataService(10); string test = iwds.FirstCharToUpper("united states"); Assert.Equals(test, "United States"); }
static void Main(string[] args) { Console.Write("Please enter the name of city: "); Location location = new Location(Console.ReadLine()); IWeatherDataService service = WeatherDataServiceFactory.GetWeatherDataService(WeatherDataServiceFactory.OPEN_WEATHER_MAP); service.GetWeatherData(location); Console.ReadLine(); }
public void GetWeatherDataTest() { IWeatherDataService service = OWMWeatherDataService.Instance; var location = new Location("London", "uk"); var data = service.GetWeatherData(location); WeatherDataTestUtils.AssertValidWeatherData(data); Assert.AreEqual(data.City.Location.City, location.City); }
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 void GetWeatherDataServiceTest() { IWeatherDataService service = WeatherDataServiceFactory. GetWeatherDataService(WeatherDataServiceFactory.WeatherDataServiceSource.OPEN_WEATHER_MAP); var location = new Location("London", "uk"); var data = service.GetWeatherData(location); WeatherDataTestUtils.AssertValidWeatherData(data); Assert.AreEqual(data.City.Location.City, location.City); }
public static IWeatherDataService GetWeatherDataService(int openService) { IWeatherDataService weatherService = null; if (openService == WeatherService.OPEN_WEATHER_MAP) { weatherService = OpenWeatherMap.Instance; } return(weatherService); }
public WeatherController ( ILogger <WeatherController> logger, IDTF IDTF, IWeatherDataService IWeatherDataService ) { this._logger = logger; this._IDTF = IDTF; this._IWeatherDataService = IWeatherDataService; }
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); }
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 UpdateWeatherForecasts( ILoginService loginService, IWeatherDataService documentStore, IClock clock, IUserSettignsDataService userSettingsDataService, DarkSkyWeatherService weatherService) : base(loginService) { this.documentStore = documentStore; this.clock = clock; this.userSettingsDataService = userSettingsDataService; this.weatherService = weatherService; }
public WeatherViewModel(INavigationService navigationService, IWeatherDataService weatherDataService, IConnectivityService connectivityService, IDialogService dialogService, ILoggingService loggingService) { _navigationService = navigationService; _weatherDataService = weatherDataService; _connectivityService = connectivityService; _dialogService = dialogService; _loggingService = loggingService; }
static void Main(string[] args) { WeatherDataServiceFactory serviceFactory = new WeatherDataServiceFactory(); IWeatherDataService newService = serviceFactory.GetWeatherDataService(dataServices.OPEN_WEATHER_MAP); Location location = new Location("Tel Aviv", "IL"); WeatherData data = newService.GetWeatherData(location); Console.WriteLine(data.ToString()); Debug.WriteLine(data.ToString()); Console.ReadLine(); }
public void checkCityAndCountryTest() { Location loc = new Location(); loc.Country = "Israel"; loc.CountryCode = "il"; loc.City = "holon"; WeatherDataServiceFactory wdf = new WeatherDataServiceFactory(); IWeatherDataService iwds = wdf.GetWeatherDataService(10); bool test = iwds.checkCityAndCountry(loc); Assert.Equals(test, true); }
public void GetWeatherDataValueTest() { // get the weather data in London using the GetWeatherData function WeatherDataServiceFactory factory = new WeatherDataServiceFactory(); IWeatherDataService weatherService = factory.GetWeatherDataService(WeatherDataServiceFactory.ServiceType.OpenWeatherMap); Location locationTest = new Location("London", "UK"); WeatherData weatherDataToTest = weatherService.GetWeatherData(locationTest); // get the weather data in London from the website string url = "http://api.openweathermap.org/data/2.5/weather?q=" + locationTest.City + "," + locationTest.Country + "&mode=xml"; WeatherData weatherSrc = GetWeatherByUrlForTesting(url); Assert.IsTrue(weatherSrc.Equals(weatherDataToTest)); }
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); }
public void TestMethod1() { Location newlocation = new Location("Haim Michael !"); try { IWeatherDataService open_map_weather = WeatherDataServiceFactory.getWeatherDataService(WeatherDataServiceFactory.OPEN_WEATHER_MAP); } catch (Exception e) { Assert.AreEqual(e.Message, "No data was fetch by ProcessResponse function using city ID"); } }
static void Main(string[] args) { //service IWeatherDataService service = WeatherDataServiceFactory.GetWeatherDataService(WeatherDataServiceFactory.WeatherService.OPEN_WEATHER_MAP); //data WeatherData weatherService = null; //location testing Location location; string city; while (true) { Console.Write("Please enter the name of the city for temp info or type exit: "); city = Console.ReadLine(); if (city == "exit" || city == "EXIT" || city == "Exit") { return; } location = new Location(city); try { weatherService = service.GetWeatherData(location); } catch (WeatherDataServiceException e) { Console.WriteLine(e); } if (weatherService != null) { //ConsoleLog messages //location Console.WriteLine("\nLocation: " + weatherService.name + " (" + weatherService.coord.lon + "," + weatherService.coord.lat + ")"); //temp Console.WriteLine("Temprature: " + weatherService.main.temp + " (min: " + weatherService.main.temp_min + ", max:" + weatherService.main.temp_max + ")"); //humidity and pressure Console.WriteLine("Humidity: " + weatherService.main.humidity + ", Pressure: " + weatherService.main.pressure); //wind and description Console.WriteLine("Wind: " + weatherService.wind.speed + "\nWeather Description: " + weatherService.weather[0].description); } else { Console.WriteLine("\nLocation not found!"); } Console.WriteLine("\nPress any key to continue...\n"); Console.ReadKey(); } }
static void Main(string[] args) { try { IWeatherDataService service = WeatherDataServiceFactory.GetWeatherDataService(WeatherDataServiceFactory.OPEN_WEATHER_MAP); WeatherData weatherData = service.GetWeatherData(new Location("London")); weatherData.PrintData(); } catch (WeatherDataServiceException e) { throw new WeatherDataServiceException(e, "XmlException"); } return; }