Example #1
0
        public void NullKeyThrowsException()
        {
            var dsClient = _factory.Create(WeatherFactory.DarkSkyServiceId, null);

            Assert.ThrowsAsync <InvalidOperationException>(async() => await dsClient.GetCurrentWeather(AlcatrazLatitude, AlcatrazLongitude));
            Assert.ThrowsAsync <InvalidOperationException>(async() => await dsClient.GetForecast(AlcatrazLatitude, AlcatrazLongitude));
            Should.ThrowAsync <InvalidOperationException>(async() => await dsClient.GetWeatherByDate(AlcatrazLatitude, AlcatrazLongitude, DateTime.Today.AddDays(+1)));

            var owClient = _factory.Create(WeatherFactory.OpenWeatherServiceId, null);

            Assert.ThrowsAsync <InvalidOperationException>(async() => await owClient.GetCurrentWeather(AlcatrazLatitude, AlcatrazLongitude));
            Assert.ThrowsAsync <InvalidOperationException>(async() => await owClient.GetForecast(AlcatrazLatitude, AlcatrazLongitude));
            Should.ThrowAsync <InvalidOperationException>(async() => await owClient.GetWeatherByDate(AlcatrazLatitude, AlcatrazLongitude, DateTime.Today.AddDays(+1)));
        }