public void PlacesNearBySearchTest() { var _request = new PlacesNearBySearchRequest { Key = this._apiKey, Location = new Location(51.491431, -3.16668), Sensor = true, Language = "en", Radius = 500, Types = new[] { SearchPlaceType.SCHOOL, SearchPlaceType.POLICE } }; var _response = GooglePlaces.NearBySearch.Query(_request); Assert.IsNotNull(_response); Assert.AreEqual(Status.OK, _response.Status); }
public void PlacesNearBySearchWhenRankByDistanceAndNameIsNullAndKeywordIsNullAndTypeIsNullTest() { var request = new PlacesNearBySearchRequest { Key = this.ApiKey, Location = new Location(51.491431, -3.16668), Rankby = Ranking.Distance }; var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.NearBySearch.Query(request)); Assert.AreEqual(_exception.Message, "If rankby=distance is specified, then one or more of keyword, name or type is required."); }
public void PlacesNearBySearchWhenRankByDistanceAndRadiusIsNotNullTest() { var request = new PlacesNearBySearchRequest { Key = this.ApiKey, Location = new Location(51.491431, -3.16668), Radius = 50001, Rankby = Ranking.Distance }; var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.NearBySearch.Query(request)); Assert.AreEqual(_exception.Message, "Radius must not have value when RankBy=distance"); }
public void PlacesNearBySearchWhenRadiusIsNullTest() { var request = new PlacesNearBySearchRequest { Key = this.ApiKey, Location = new Location(51.491431, -3.16668), Radius = null }; var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.NearBySearch.Query(request)); Assert.AreEqual(_exception.Message, "Radius must not be null when RankBy is not Distance"); }
public void PlacesNearBySearchWhenRadiusIsLessThanOneTest() { var request = new PlacesNearBySearchRequest { Key = this.ApiKey, Location = new Location(51.491431, -3.16668), Radius = 0 }; var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.NearBySearch.Query(request)); Assert.AreEqual(_exception.Message, "Radius must be greater than or equal to 1 and less than or equal to 50.000."); }
public void PlacesNearBySearchWhenLocationIsNullTest() { var request = new PlacesNearBySearchRequest { Key = this.ApiKey, Location = null }; var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.NearBySearch.Query(request)); Assert.AreEqual(_exception.Message, "Location must not be null"); }
public void PlacesNearBySearchWhenApiKeyIsStringEmptyTest() { var request = new PlacesNearBySearchRequest { Key = string.Empty }; var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.NearBySearch.Query(request)); Assert.AreEqual(_exception.Message, "ApiKey must be provided"); }
public void PlacesNearBySearchTest() { var request = new PlacesNearBySearchRequest { Key = this.ApiKey, Location = new Location(51.491431, -3.16668), Sensor = true, Language = "en", Radius = 500, Type = SearchPlaceType.School }; var response = GooglePlaces.NearBySearch.Query(request); Assert.IsNotNull(response); Assert.AreEqual(Status.Ok, response.Status); }