public async void UnicodeLanguageIsSupported() { var client = new ForecastApi(this.apiKey); var result = await client.GetWeatherDataAsync(AlcatrazLatitude, AlcatrazLongitude, Unit.Auto, Language.Chinese); Assert.That(result, Is.Not.Null); }
protected async virtual Task <int> TimerElapsedTask() { var forecast = await _api.GetWeatherDataAsync(40.7505045d, -73.9934387d); int tempC = (int)(5.0 / 9.0 * (forecast.Currently.Temperature - 32)); return(tempC); }
public async void NonUSDataCanBeRetrieved() { var client = new ForecastApi(this.apiKey); var result = await client.GetWeatherDataAsync(MumbaiLatitude, MumbaiLongitude); Assert.That(result, Is.Not.Null); Assert.That(result.Currently, Is.Not.Null); }
public async void ValidKeyRetrievesData() { var client = new ForecastApi(this.apiKey); var result = await client.GetWeatherDataAsync(AlcatrazLatitude, AlcatrazLongitude); Assert.That(result, Is.Not.Null); Assert.That(result.Currently, Is.Not.Null); }
public async void UnitsCanBeSpecified() { var client = new ForecastApi(this.apiKey); var result = await client.GetWeatherDataAsync(AlcatrazLatitude, AlcatrazLongitude, Unit.CA); Assert.That(result, Is.Not.Null); Assert.That(result.Flags.Units, Is.EqualTo(Unit.CA.ToValue())); }
/// <summary> /// Checks that requests can be made with Unit.UK. /// </summary> public async void UnitUKWorksCorrectly() { var client = new ForecastApi(this.apiKey); var result = await client.GetWeatherDataAsync(MumbaiLatitude, MumbaiLongitude, Unit.UK); Assert.That(result, Is.Not.Null); Assert.That(result.Currently, Is.Not.Null); }
public async void WorksWithPeriodDecimalSeperator() { var client = new ForecastApi(this.apiKey); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); var result = await client.GetWeatherDataAsync(AlcatrazLatitude, AlcatrazLongitude); Assert.That(result, Is.Not.Null); Assert.That(result.Currently, Is.Not.Null); }
public async void ExclusionWorksCorrectly() { var client = new ForecastApi(this.apiKey); var exclusionList = new List <Exclude> { Exclude.Minutely }; var result = await client.GetWeatherDataAsync(AlcatrazLatitude, AlcatrazLongitude, Unit.US, exclusionList); Assert.That(result, Is.Not.Null); Assert.That(result.Currently, Is.Not.Null); Assert.That(result.Minutely, Is.Null); }
private static async Task GetForcast(dynamic x, double latitude, double longitude) { //if (ForecastRetrieved < DateTime.Now.AddMinutes(5)) //{ // return; //} ForecastApi api = new ForecastApi(x.apikey); forecast = await api.GetWeatherDataAsync(latitude, longitude); ForecastRetrieved = DateTime.Now; }
public async Task <IList <DayForecast> > GetForecast(double latitude, double longitude, DateTimeOffset?forecastDate = null) { try { var client = new ForecastApi(FORECAST_API_KEY); Forecast result; if (forecastDate != null) { result = await client.GetTimeMachineWeatherAsync(latitude, longitude, (DateTimeOffset)forecastDate); } else { result = await client.GetWeatherDataAsync(latitude, longitude); } var days = WeatherFactory.CreateDayForecasts(result); return(days); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return(null); } }
public void EmptyKeyThrowsException() { var client = new ForecastApi(string.Empty); Assert.That(async() => await client.GetWeatherDataAsync(AlcatrazLatitude, AlcatrazLongitude), Throws.InvalidOperationException); }