Esempio n. 1
0
        public async Task CanSuggest()
        {
            var gateway = new GeocodeGateway(new ServiceStackSerializer());
            var suggest = new SuggestGeocode("/World/GeocodeServer/".AsEndpoint())
            {
                Text = "100 Willis Street, Wellington"
            };
            var response = await gateway.Suggest(suggest);

            Assert.Null(response.Error);
            Assert.NotNull(response.Suggestions);
            Assert.True(response.Suggestions.Any());
            var result = response.Suggestions.First();
            Assert.True(!string.IsNullOrWhiteSpace(result.Text));
        }
Esempio n. 2
0
        public async Task CanSuggest()
        {
            var gateway = new GeocodeGateway(new ServiceStackSerializer());
            var suggest = new SuggestGeocode("/World/GeocodeServer/".AsEndpoint())
            {
                Text = "100 Willis Street, Wellington"
            };
            var response = await gateway.Suggest(suggest);

            Assert.Null(response.Error);
            Assert.NotNull(response.Suggestions);
            Assert.True(response.Suggestions.Any());
            var result = response.Suggestions.First();

            Assert.True(!string.IsNullOrWhiteSpace(result.Text));
        }
Esempio n. 3
0
        public async Task CanGeocode()
        {
            var gateway = new GeocodeGateway(new ServiceStackSerializer());
            var geocode = new SingleInputGeocode("/World/GeocodeServer/".AsEndpoint())
            {
                Text = "100 Willis Street, Wellington",
                SourceCountry = "NZL"
            };
            var response = await gateway.Geocode(geocode);

            Assert.Null(response.Error);
            Assert.NotNull(response.SpatialReference);
            Assert.NotNull(response.Results);
            Assert.True(response.Results.Any());
            var result = response.Results.First();
            Assert.NotNull(result.Feature);
        }
Esempio n. 4
0
        public async Task CanGeocode()
        {
            var gateway = new GeocodeGateway(new ServiceStackSerializer());
            var geocode = new SingleInputGeocode("/World/GeocodeServer/".AsEndpoint())
            {
                Text          = "100 Willis Street, Wellington",
                SourceCountry = "NZL"
            };
            var response = await gateway.Geocode(geocode);

            Assert.Null(response.Error);
            Assert.NotNull(response.SpatialReference);
            Assert.NotNull(response.Results);
            Assert.True(response.Results.Any());
            var result = response.Results.First();

            Assert.NotNull(result.Feature);
            Assert.NotNull(result.Feature.Geometry);
        }
Esempio n. 5
0
        public async Task CanReverseGeocodePoint()
        {
            var gateway = new GeocodeGateway(new ServiceStackSerializer());
            var reverseGeocode = new ReverseGeocode("/World/GeocodeServer/".AsEndpoint())
            {
                Location = new Point
                {
                    X = 174.775505,
                    Y = -41.290893,
                    SpatialReference = new SpatialReference { Wkid = SpatialReference.WGS84.LatestWkid }
                }
            };
            var response = await gateway.ReverseGeocode(reverseGeocode);

            Assert.Null(response.Error);
            Assert.NotNull(response.Address);
            Assert.NotNull(response.Location);
            Assert.Equal(response.Address.CountryCode, "NZL");
        }
Esempio n. 6
0
        public async Task CanReverseGeocodePoint()
        {
            var gateway        = new GeocodeGateway(new ServiceStackSerializer());
            var reverseGeocode = new ReverseGeocode("/World/GeocodeServer/".AsEndpoint())
            {
                Location = new Point
                {
                    X = 174.775505,
                    Y = -41.290893,
                    SpatialReference = new SpatialReference {
                        Wkid = SpatialReference.WGS84.LatestWkid
                    }
                }
            };
            var response = await gateway.ReverseGeocode(reverseGeocode);

            Assert.Null(response.Error);
            Assert.NotNull(response.Address);
            Assert.NotNull(response.Location);
            Assert.Equal(response.Address.CountryCode, "NZL");
        }