Exemplo n.º 1
0
        public void GetUriTest()
        {
            var request = new LocationGeocodeRequest
            {
                Key      = "abc",
                Location = new Entities.Common.Location(1, 1)
            };

            var uri = request.GetUri();

            Assert.IsNotNull(uri);
            Assert.AreEqual($"/maps/api/geocode/json?key={request.Key}&language={request.Language.ToCode()}&latlng={Uri.EscapeDataString(request.Location.ToString())}", uri.PathAndQuery);
        }
Exemplo n.º 2
0
        public void GetUriWhenLocationTypeTest()
        {
            var request = new LocationGeocodeRequest
            {
                Key           = "abc",
                Location      = new Entities.Common.Location(1, 1),
                LocationTypes = new[]
                {
                    GeometryLocationType.Rooftop
                }
            };

            var uri = request.GetUri();

            Assert.IsNotNull(uri);
            Assert.AreEqual($"/maps/api/geocode/json?key={request.Key}&language={request.Language.ToCode()}&latlng={Uri.EscapeDataString(request.Location.ToString())}&location_type={Uri.EscapeDataString(string.Join("|", request.LocationTypes.Select(x => x.ToString().ToUpper()).AsEnumerable()))}", uri.PathAndQuery);
        }
Exemplo n.º 3
0
        public void GetUriWhenResultTypeTest()
        {
            var request = new LocationGeocodeRequest
            {
                Key         = "abc",
                Location    = new Entities.Common.Location(1, 1),
                ResultTypes = new[]
                {
                    PlaceLocationType.Accounting,
                    PlaceLocationType.Administrative_Area_Level_1
                }
            };

            var uri = request.GetUri();

            Assert.IsNotNull(uri);
            Assert.AreEqual($"/maps/api/geocode/json?key={request.Key}&language={request.Language.ToCode()}&latlng={Uri.EscapeDataString(request.Location.ToString())}&result_type={Uri.EscapeDataString(string.Join("|", request.ResultTypes.Select(x => x.ToString().ToLower()).AsEnumerable()))}", uri.PathAndQuery);
        }