Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 public void DarkSkyService_Initializes_WhenAllParametersAreSupplied()
 {
     _darkSkyService = new DarkSkyService(_weatherDataRetriever, _darkSkyConfigurationManager);
     Assert.IsNotNull(_darkSkyService);
     Assert.IsInstanceOf <DarkSkyService>(_darkSkyService);
     Assert.IsInstanceOf <IDarkSkyService>(_darkSkyService);
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes our darkSkyService, and memory cache
 /// </summary>
 /// <param name="darkSkyService"></param>
 public ForecastViewModel(IDarkSkyService darkSkyService)
 {
     _darkSkyService = darkSkyService;
     cachedData      = MemoryCache.Default;
 }
Ejemplo n.º 7
0
 /// <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);
 }
Ejemplo n.º 8
0
 public WeatherController(IDarkSkyService api)
 {
     _api = api;
 }
Ejemplo n.º 9
0
 public void GetWeatherDataForCity_Throws_WhenTheRawResponseIsNull()
 {
     _darkSkyService = new DarkSkyService(_weatherDataRetrieverToReturnEmpty, _darkSkyConfigurationManager);
     Assert.ThrowsAsync <ArgumentNullException>(() => _darkSkyService.GetWeatherDataForCity(city));
 }
Ejemplo n.º 10
0
 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;
 }
Ejemplo n.º 12
0
 public WeatherService(IDarkSkyService client, IGeocoder geocoder)
 {
     _client   = client;
     _geocoder = geocoder;
 }