public void GetUriWhenPageTokenTest()
        {
            var request = new PlacesNearBySearchRequest
            {
                Key       = "abc",
                PageToken = "abc"
            };

            var uri = request.GetUri();

            Assert.IsNotNull(uri);
            Assert.AreEqual($"/maps/api/place/nearbysearch/json?key={request.Key}&pagetoken={request.PageToken}", uri.PathAndQuery);
        }
Example #2
0
        public void GetUriTest()
        {
            var request = new PlacesNearBySearchRequest
            {
                Key      = "abc",
                Location = new Location(1, 1),
                Radius   = 50
            };

            var uri = request.GetUri();

            Assert.IsNotNull(uri);
            Assert.AreEqual($"/maps/api/place/nearbysearch/json?key={request.Key}&rankby={request.Rankby.ToString().ToLower()}&language={request.Language.ToCode()}&location={Uri.EscapeDataString(request.Location.ToString())}&radius={request.Radius}", uri.PathAndQuery);
        }
Example #3
0
        public void GetUriWhenMaxpriceTest()
        {
            var request = new PlacesNearBySearchRequest
            {
                Key      = "abc",
                Location = new Location(1, 1),
                Radius   = 50,
                Maxprice = PriceLevel.Free
            };

            var uri = request.GetUri();

            Assert.IsNotNull(uri);
            Assert.AreEqual($"/maps/api/place/nearbysearch/json?key={request.Key}&rankby={request.Rankby.ToString().ToLower()}&language={request.Language.ToCode()}&location={Uri.EscapeDataString(request.Location.ToString())}&radius={request.Radius}&maxprice={((int)request.Maxprice.GetValueOrDefault()).ToString()}", uri.PathAndQuery);
        }
Example #4
0
        public void GetUriWhenTypeTest()
        {
            var request = new PlacesNearBySearchRequest
            {
                Key      = "abc",
                Location = new Location(1, 1),
                Radius   = 50,
                Type     = SearchPlaceType.Accounting
            };

            var uri       = request.GetUri();
            var attribute = request.Type?.GetType().GetMembers().FirstOrDefault(x => x.Name == request.Type.ToString())?.GetCustomAttribute <EnumMemberAttribute>();

            Assert.IsNotNull(uri);
            Assert.AreEqual($"/maps/api/place/nearbysearch/json?key={request.Key}&rankby={request.Rankby.ToString().ToLower()}&language={request.Language.ToCode()}&location={Uri.EscapeDataString(request.Location.ToString())}&radius={request.Radius}&type={attribute?.Value.ToLower()}", uri.PathAndQuery);
        }