public MainWindow() { InitializeComponent(); _weatherService = new GetWeatherService(); _applicationContext = new ApplicationContext(); _root = new Root(); }
public MainWindow() { InitializeComponent(); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); _applicationContext = new ApplicationContext(); _weatherService = new GetWeatherService(); _cities = new GetCity(); cityList = _cities.FillCity(); }
public void GetWeatherInfo_NoLocation_ReturnsCorrectInfo() { GetWeatherService service = new GetWeatherService(null, null); var result = service.GetWeatherInfo().Result; Assert.AreEqual("Paularino (US)", result.Location); Assert.AreEqual(10.96f, result.Temp, 0.1); Assert.AreEqual(8.7f, result.TempMin, 0.1); Assert.AreEqual(13.3f, result.TempMax, 0.1); Assert.AreEqual(4.07f, result.Wind, 0.1); Assert.AreEqual(96, result.Humidity); }
public void GetWeatherInfo_WithZipCode_ReturnsCorrectInfo() { GetWeatherService service = new GetWeatherService(null, "92704,us"); var result = service.GetWeatherInfo().Result; Assert.AreEqual("Santa Ana (US)", result.Location); Assert.AreEqual(11.02f, result.Temp, 0.1); Assert.AreEqual(8.7f, result.TempMin, 0.1); Assert.AreEqual(13.3f, result.TempMax, 0.1); Assert.AreEqual(1.45, result.Wind, 0.1); Assert.AreEqual(89, result.Humidity); }
public void GetWeatherInfo_NoLocation_ThrowArgumentException() { try { GetWeatherService service = new GetWeatherService(null, ""); var _ = service.GetWeatherInfo().Result; Assert.Fail(); } catch (AggregateException e) { Assert.AreEqual( typeof(InsufficientDataException), e.InnerException.GetType(), "Unable to retrieve location information"); } }
public void GetWeatherInfo_InvalidLocation_ThrowArgumentException() { try { GetWeatherService service = new GetWeatherService(null, "heaven"); var _ = service.GetWeatherInfo().Result; Assert.Fail(); } catch (AggregateException e) { Assert.AreEqual( typeof(ArgumentException), e.InnerException.GetType(), "Provided location is not found"); } }
public void GetWeatherInfo_WrongApiKey_ThrowArgumentException() { try { GetWeatherService service = new GetWeatherService("qwerty", "92704, us"); var _ = service.GetWeatherInfo().Result; Assert.Fail(); } catch (AggregateException e) { Assert.AreEqual( typeof(ArgumentException), e.InnerException.GetType(), "Api Key is incorrect"); } }
public Weather() { InitializeComponent(); _weatherServies = new GetWeatherService(); }
public MainWindow() { InitializeComponent(); str = new ObservableCollection <string>(); _weatherServies = new GetWeatherService(); }
public async Task DoWork() { GetWeatherService service = new GetWeatherService(ApiKey, InputLocation, TempUnit); Info = await service.GetWeatherInfo(); }