Beispiel #1
0
        public Location GetLocation(string clubName)
        {
            var course = new GolfCourse(clubName);
            var json = GoogleAPI.FetchGoogleData(course);

            return JsonConvert.DeserializeObject<Location>(json);
        }
Beispiel #2
0
        public void TestGoogleData()
        {
            var course = new GolfCourse("remuera golf club");
            string json = GoogleAPI.FetchGoogleData(course);

            var location = JsonConvert.DeserializeObject<Location>(json);

            Assert.IsNotNull(location.results.First().formatted_address);
        }
Beispiel #3
0
 public static string FetchGoogleData(GolfCourse course)
 {
     string name = course.Name;
     var r = WebRequest.Create(new Uri(BaseUrl + name + "&" +KEY));
     return new StreamReader(r.GetResponse().GetResponseStream()).ReadToEnd();
 }