Esempio n. 1
0
        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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }