Simple class that wraps a longitude and latitude
Пример #1
0
 ///<summary>
 ///Call the DarkSky forecast API.
 ///<param name="location">lat/lon of location to forecast</param>
 ///<returns>ForecastObject that represents the v1 forecast return result.</returns>
 ///</summary>
 public ForecastObject Forecast(Geolocation location)
 {
     string url = String.Format("{0}/forecast/{1}/{2}", API.uri, API.key, location);
     string s = DoGetRequest(url);
     DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(ForecastObject));
     MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(s));
     ForecastObject forecastObject = serializer.ReadObject(ms) as ForecastObject;
     return forecastObject;
 }
Пример #2
0
 public void ForecastTest()
 {
     DarkSky darkSky = new DarkSky();
     Geolocation location = new Geolocation();
     //string expected = string.Empty; // TODO: Initialize to an appropriate value
     ForecastObject fo = darkSky.Forecast(location);
     Console.WriteLine("{0}", fo.DayPrecipitationList[0].Type);
     //Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Пример #3
0
 public void PrecipitationTest()
 {
     DarkSky darkSky = new DarkSky();
     Geolocation location = new Geolocation();
     //string expected = string.Empty; // TODO: Initialize to an appropriate value
     List<KeyValuePair<Geolocation, int>> list = new List<KeyValuePair<Geolocation, int>>()
     {
         new KeyValuePair<Geolocation, int>(location, 1331416523),
         new KeyValuePair<Geolocation, int>(location, 1331416777)
     };
     PrecipitationObject po = darkSky.Precipitation(list);
     Console.WriteLine("{0}", po.PrecipitationList[0].Type);
     //Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }