예제 #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));
        }
예제 #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));
        }
예제 #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);
        }
예제 #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);
        }
예제 #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");
        }
예제 #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");
        }