public void StaticJSONWeather() { // static JSON response for a Denver current weather request (should be a test within the models) string json = "{\"coord\":{\"lon\":-104.98,\"lat\":39.74},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01n\"}],\"base\":\"stations\",\"main\":{\"temp\":277.17,\"pressure\":1023,\"humidity\":74,\"temp_min\":272.15,\"temp_max\":281.15},\"visibility\":16093,\"wind\":{\"speed\":1.5,\"deg\":200},\"clouds\":{\"all\":1},\"dt\":1515206160,\"sys\":{\"type\":1,\"id\":602,\"message\":0.0043,\"country\":\"US\",\"sunrise\":1515248470,\"sunset\":1515282652},\"id\":5419384,\"name\":\"Denver\",\"cod\":200}"; // we should be able to parse this into a current weather object Current_Weather weather = JsonConvert.DeserializeObject <Current_Weather>(json); // this object should have a name of "Denver" Assert.IsTrue(weather != null && weather.name == "Denver"); }
public async Task GetWeather() { // make a request to get the current weather in Phoenix // id=5308655 string json = await Requests.Weather.Current(5308655, redis); // we should be able to parse this into a current weather object Current_Weather weather = JsonConvert.DeserializeObject <Current_Weather>(json); // the object should have a city name of Phoenix Assert.IsTrue(weather != null && weather.name == "Phoenix"); }