PlacesRadarSearch Request. A Radar Search request must include at least one of keyword, name, or types.
Inheritance: GoogleApi.Entities.Places.Search.Common.BasePlacesSearchRequest
Beispiel #1
0
        public void PlacesRadarSearchTest()
        {
            var _request = new PlacesRadarSearchRequest
            {
                Key = this._apiKey,
                Location = new Location(51.491431, -3.16668),
                Radius = 500,
                Sensor = true,
                Language = "en",
                Keyword = "abc"
            };

            var _response = GooglePlaces.RadarSearch.Query(_request);

            Assert.IsNotNull(_response);
            Assert.AreEqual(Status.OK, _response.Status);
        }
Beispiel #2
0
        public void PlacesRadarSearchWhenLocationIsNullTest()
        {
            var request = new PlacesRadarSearchRequest
            {
                Key = this.ApiKey,
                Location = null
            };

            var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.RadarSearch.Query(request));
            Assert.AreEqual(_exception.Message, "Location must not be null");
        }
Beispiel #3
0
        public void PlacesRadarSearchWhenApiKeyIsStringEmptyTest()
        {
            var request = new PlacesRadarSearchRequest
            {
                Key = string.Empty
            };

            var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.RadarSearch.Query(request));
            Assert.AreEqual(_exception.Message, "ApiKey must be provided");
        }
Beispiel #4
0
        public void PlacesRadarSearchTest()
        {
            var request = new PlacesRadarSearchRequest
            {
                Key = this.ApiKey,
                Location = new Location(55.673323, 12.527438),
                Radius = 500,
                Sensor = true,
                Language = "en",
                Keyword = "abc"
            };

            var response = GooglePlaces.RadarSearch.Query(request);

            Assert.IsNotNull(response);
            Assert.AreEqual(Status.Ok, response.Status);
        }
Beispiel #5
0
        public void PlacesRadarSearchWhenRankByDistanceAndNameIsNullAndKeywordIsNullAndTypeIsNullTest()
        {
            var request = new PlacesRadarSearchRequest
            {
                Key = this.ApiKey,
                Location = new Location(51.491431, -3.16668),
                Radius = 1
            };

            var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.RadarSearch.Query(request));
            Assert.AreEqual(_exception.Message, "Request must include at least one of keyword, name or type");
        }
Beispiel #6
0
        public void PlacesRadarSearchWhenRadiusIsLessThanOneTest()
        {
            var request = new PlacesRadarSearchRequest
            {
                Key = this.ApiKey,
                Location = new Location(51.491431, -3.16668),
                Radius = 0
            };

            var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.RadarSearch.Query(request));
            Assert.AreEqual(_exception.Message, "Radius must be greater than or equal to 1 and less than or equal to 50.000.");
        }