public Location GetLocation(string clubName) { var course = new GolfCourse(clubName); var json = GoogleAPI.FetchGoogleData(course); return JsonConvert.DeserializeObject<Location>(json); }
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); }
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(); }