コード例 #1
0
            public async Task Should_create_extra_for_address_reversal()
            {
                var parsedAddress = new CleansedAddress("inputAddress", 1, 0, 0, Direction.North, "2", StreetType.Alley,
                                                        Direction.South, 0, 84114, false, false);
                var address = new GeocodeAddress(parsedAddress)
                {
                    AddressGrids = new[] { new PlaceGridLink("place", "grid", 0) }
                };

                var geocodeOptions = new GeocodingOptions {
                    Locators         = LocatorType.RoadCenterlines,
                    SpatialReference = 26912
                };

                var request = new LocatorsForGeocode.Command(address, geocodeOptions);
                var result  = await Handler.Handle(request, new CancellationToken());

                result.Count.ShouldBe(2);

                result.Count(x => x.Url ==
                             "proto://test:1/arcgis/rest/services/Geolocators/Roads_AddressSystem_STREET/GeocodeServer/findAddressCandidates?f=json&Street=1+North+2+Alley+South&City=grid&outSR=26912")
                .ShouldBe(1);
                result.Count(x => x.Url ==
                             "proto://test:1/arcgis/rest/services/Geolocators/Roads_AddressSystem_STREET/GeocodeServer/findAddressCandidates?f=json&Street=2+South+Alley+1+North&City=grid&outSR=26912")
                .ShouldBe(1);
            }
コード例 #2
0
            public async Task Should_return_all_geocoders()
            {
                var parsedAddress = new CleansedAddress("inputAddress", 1, 0, 0, Direction.North, "street",
                                                        StreetType.Alley, Direction.South, 0, 84114, false, false);
                var address = new GeocodeAddress(parsedAddress)
                {
                    AddressGrids = new[] { new PlaceGridLink("place", "grid", 0) }
                };

                var geocodeOptions = new GeocodingOptions {
                    Locators         = LocatorType.All,
                    SpatialReference = 26912
                };

                var request = new LocatorsForGeocode.Command(address, geocodeOptions);
                var result  = await Handler.Handle(request, new CancellationToken());

                result.Count.ShouldBe(2);

                geocodeOptions = new GeocodingOptions {
                    Locators         = LocatorType.Default,
                    SpatialReference = 26912
                };

                request = new LocatorsForGeocode.Command(address, geocodeOptions);
                result  = await Handler.Handle(request, new CancellationToken());

                result.Count.ShouldBe(2);
            }
コード例 #3
0
            public async Task Should_return_empty_when_no_grids()
            {
                var parsedAddress = new CleansedAddress("inputAddress", 1, 0, 0, Direction.North, "street",
                                                        StreetType.Alley, Direction.South, 0, 84114, false, false);
                var address = new GeocodeAddress(parsedAddress)
                {
                    AddressGrids = Array.Empty <GridLinkable>()
                };

                var geocodeOptions = new GeocodingOptions {
                    Locators         = LocatorType.RoadCenterlines,
                    SpatialReference = 26912
                };

                var request = new LocatorsForGeocode.Command(address, geocodeOptions);
                var result  = await Handler.Handle(request, new CancellationToken());

                result.ShouldBeEmpty();
            }
コード例 #4
0
            public async Task Should_return_centerline_geocoder_only()
            {
                var parsedAddress = new CleansedAddress("inputAddress", 1, 0, 0, Direction.North, "street",
                                                        StreetType.Alley, Direction.South, 0, 84114, false, false);
                var address = new GeocodeAddress(parsedAddress)
                {
                    AddressGrids = new[] { new PlaceGridLink("place", "grid", 0) }
                };

                var geocodeOptions = new GeocodingOptions {
                    Locators         = LocatorType.RoadCenterlines,
                    SpatialReference = 26912
                };

                var request = new LocatorsForGeocode.Command(address, geocodeOptions);
                var result  = await Handler.Handle(request, new CancellationToken());

                result.ShouldHaveSingleItem();

                var locator = result.First();

                locator.Url.ShouldBe("proto://test:1/arcgis/rest/services/Geolocators/Roads_AddressSystem_STREET/GeocodeServer/findAddressCandidates?f=json&Street=1+North+street+Alley+South&City=grid&outSR=26912");
                locator.Name.ShouldBe("Centerlines.StatewideRoads");
            }