Exemplo n.º 1
0
        /*
         * This function add parameters to the API request and calls the API.
         * It also Deserialize the response to a instance of WeatherForecastResponse
         * which can then be used for verification.
         * */
        public void CallRequest(string city, string country, string tempUnits)
        {
            Console.WriteLine("\t Sending a GET request to the WeatherForecast API");
            APIrequest.AddParameter("q", (city + "," + country));
            APIrequest.AddParameter("APPID", AppID);
            APIrequest.AddParameter("units", tempUnits);

            string res = APIclient.Execute(APIrequest).Content;

            response = JsonConvert.DeserializeObject <WeatherForecastResponse>(res);
        }