Places Details Request.
Inheritance: GoogleApi.Entities.Places.Common.BasePlacesRequest, IQueryStringRequest
コード例 #1
0
ファイル: PlacesTest.cs プロジェクト: JasonBSteele/GoogleApi
        public void PlacesDetauilsTest()
        {
            var _request = new PlacesAutoCompleteRequest
            {
                Key = _apiKey,
                Input = "jagtvej 2200",
                Sensor = true,
                Language = "en",
            };

            var _response = GooglePlaces.AutoComplete.Query(_request);
            var _results = _response.Predictions.ToList();
            var _result = _results.First();
            
            var _request2 = new PlacesDetailsRequest
            {
                Key = _apiKey,
                PlaceId = _result.PlaceId,
                Sensor = true,
            };

            var _response2 = GooglePlaces.Details.Query(_request2);
            Assert.AreEqual(Status.OK, _response2.Status);
        }
コード例 #2
0
ファイル: GooglePlacesTest.cs プロジェクト: vivet/GoogleApi
        public void PlacesDetailsWhenApiKeyIsNullTest()
        {
            var request = new PlacesDetailsRequest
            {
                Key = null
            };

            var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.Details.Query(request));
            Assert.AreEqual(_exception.Message, "ApiKey must be provided");
        }
コード例 #3
0
ファイル: GooglePlacesTest.cs プロジェクト: vivet/GoogleApi
        public void PlacesDetailsWhenPlaceIdIsStringEmptyTest()
        {
            var request = new PlacesDetailsRequest
            {
                Key = ApiKey,
                PlaceId = string.Empty
            };

            var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.Details.Query(request));
            Assert.AreEqual(_exception.Message, "PlaceId must be provided.");
        }
コード例 #4
0
ファイル: GooglePlacesTest.cs プロジェクト: vivet/GoogleApi
        public void PlacesDetailsAsyncTest()
        {
            var request = new PlacesAutoCompleteRequest
            {
                Key = ApiKey,
                Input = "jagtvej 2200",
                Sensor = true,
                Language = "en",
            };

            var response = GooglePlaces.AutoComplete.QueryAsync(request).Result;
            var results = response.Predictions.ToArray();
            var result = results.First();

            var request2 = new PlacesDetailsRequest
            {
                Key = ApiKey,
                PlaceId = result.PlaceId,
                Sensor = true,
            };

            var response2 = GooglePlaces.Details.Query(request2);
            Assert.AreEqual(Status.Ok, response2.Status);
        }