Esempio n. 1
0
        public async Task CanPagePointQuery(string rootUrl, string relativeUrl, int start, int numberToReturn)
        {
            var gateway = new PortalGateway(rootUrl);

            var queryCount  = new QueryForCount(relativeUrl);
            var resultCount = await IntegrationTestFixture.TestPolicy.ExecuteAsync(() =>
            {
                return(gateway.QueryForCount(queryCount));
            });

            Assert.NotNull(resultCount);
            Assert.Null(resultCount.Error);
            Assert.NotEqual(numberToReturn, resultCount.NumberOfResults);
            Assert.True(numberToReturn < resultCount.NumberOfResults);

            var query = new Query(relativeUrl.AsEndpoint())
            {
                ResultOffset = start, ResultRecordCount = numberToReturn
            };
            var result = await IntegrationTestFixture.TestPolicy.ExecuteAsync(() =>
            {
                return(gateway.Query <Point>(query));
            });

            Assert.NotNull(result);
            Assert.Null(result.Error);
            Assert.True(result.Features.Any());
            Assert.Equal(numberToReturn, result.Features.Count());
        }
Esempio n. 2
0
        private async Task QueryCanGetBatchFeatures <T>(string rootUrl, string relativeUrl, bool returnGeometry)
            where T : IGeometry
        {
            var gateway = new PortalGateway(rootUrl);
            var query   = new Query(relativeUrl)
            {
                ReturnGeometry = returnGeometry
            };

            var result = await IntegrationTestFixture.TestPolicy.ExecuteAsync(() =>
            {
                return(gateway.BatchQuery <T>(query));
            });

            // Get total count of features to check that batch query returned everything
            var queryCount  = new QueryForCount(relativeUrl);
            var countResult = await gateway.QueryForCount(queryCount);

            Assert.NotNull(result);
            Assert.Null(result.Error);
            Assert.True(result.Features.Any());
            Assert.Null(result.Links);
            Assert.Equal(result.Features.Count(), countResult.NumberOfResults);
            if (returnGeometry)
            {
                Assert.NotNull(result.SpatialReference);
                Assert.True(result.Features.All(i => i.Geometry != null));
                Assert.Equal(typeof(T), result.GeometryType);
            }
        }
Esempio n. 3
0
        public async Task CanQueryForCount()
        {
            var gateway = new PortalGateway("http://services.arcgisonline.com/arcgis/");

            var query  = new QueryForCount(@"/Specialty/Soil_Survey_Map/MapServer/2".AsEndpoint());
            var result = await IntegrationTestFixture.TestPolicy.ExecuteAsync(() =>
            {
                return(gateway.QueryForCount(query));
            });

            Assert.NotNull(result);
            Assert.Null(result.Error);
            Assert.True(result.NumberOfResults > 0);
        }