public MainWindowViewModel(IDarkSkyService darkSkyService, ICityService cityService) { _cityService = ArgumentValidation.ThrowIfNull <ICityService>(cityService, nameof(cityService)); _darkSkyService = ArgumentValidation.ThrowIfNull <IDarkSkyService>(darkSkyService, nameof(darkSkyService)); _availableWeatherInfo = new ObservableCollection <WeatherDataRoot>(); _isThereAConnectionError = false; }
public void DarkSkyService_Initializes_WhenAllParametersAreSupplied() { _darkSkyService = new DarkSkyService(_weatherDataRetriever, _darkSkyConfigurationManager); Assert.IsNotNull(_darkSkyService); Assert.IsInstanceOf <DarkSkyService>(_darkSkyService); Assert.IsInstanceOf <IDarkSkyService>(_darkSkyService); }
public async Task GetWeatherDataForCity_SuccessfullyParses_NormalJSONString() { _darkSkyService = new DarkSkyService(_weatherDataRetriever, _darkSkyConfigurationManager); WeatherDataRoot weatherData = await _darkSkyService.GetWeatherDataForCity(city); Assert.IsNotNull(weatherData); Assert.IsNotNull(weatherData.CurrentWeather); Assert.AreEqual(weatherData.CurrentWeather.Temperature, -1.73); Assert.AreEqual(weatherData.CurrentWeather.Icon, IconValue.CLOUDY); Assert.AreEqual(weatherData.CurrentWeather.Humidity, 0.96); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); IUnityContainer container = DependencyConfiguration.BuildUnityContainer(); IDarkSkyService darkSkyService = container.Resolve <DarkSkyService>(); ICityService cityService = container.Resolve <CityService>(); MainWindow mainWindow = new MainWindow(new MainWindowViewModel(darkSkyService, cityService)); mainWindow.Show(); }
public EnergyFuturesService( ILogService logService, IAmberService amberService, IDarkSkyService darkSkyService, IInfluxService influxService, IOptions <EnergyHostSettings> options) { _logService = logService; _amberService = amberService; _darkSkyService = darkSkyService; _influxService = influxService; _options = options; }
/// <summary> /// Initializes our darkSkyService, and memory cache /// </summary> /// <param name="darkSkyService"></param> public ForecastViewModel(IDarkSkyService darkSkyService) { _darkSkyService = darkSkyService; cachedData = MemoryCache.Default; }
/// <summary> /// Initializes a new instance of the weather service /// </summary> /// <param name="apiKey">The API key to use.</param> /// <param name="handler">the http message handler. If null use the default one.</param> public DarkSkyWrapper(string apiKey, HttpMessageHandler handler) { _service = new DarkSkyService(apiKey, handler); }
public WeatherController(IDarkSkyService api) { _api = api; }
public void GetWeatherDataForCity_Throws_WhenTheRawResponseIsNull() { _darkSkyService = new DarkSkyService(_weatherDataRetrieverToReturnEmpty, _darkSkyConfigurationManager); Assert.ThrowsAsync <ArgumentNullException>(() => _darkSkyService.GetWeatherDataForCity(city)); }
public void GetWeatherDataForCity_Throws_WhenCityIsNull() { _darkSkyService = new DarkSkyService(_weatherDataRetriever, _darkSkyConfigurationManager); Assert.ThrowsAsync <ArgumentNullException>(() => _darkSkyService.GetWeatherDataForCity(null)); }
public IndexModel(ILocationService locationService, IDarkSkyService darkSkyService) { _locationService = locationService; _darkSkyService = darkSkyService; }
public WeatherService(IDarkSkyService client, IGeocoder geocoder) { _client = client; _geocoder = geocoder; }