Пример #1
0
            public void PointSearchWithNoBufferFindsNothing()
            {
                const string featureClass = "SGID10.ELEVATION.HighestPeaks";
                var args = new QueryArgs(featureClass, "point:[445190.8,4471328.55]", new[] {"NAME"}, "");

                var client = new HttpClient();
                var url = "http://localhost:6080/arcgis/rest/services/Soe/SearchApi/MapServer/exts/Search/Search?{0}&f=json"
                    .With(args.ToQueryString());

                var response = client.GetAsync(url);
                var result = response.Result.Content.ReadAsStringAsync().Result;

                Assert.That(result, Is.Not.Null);
                Assert.That(result, Is.StringStarting("{\"Results\":[]").IgnoreCase);
            }
Пример #2
0
            public void PointSearchWithNoBufferFindsNothing()
            {
                const string featureClass = "SGID10.ELEVATION.HighestPeaks";
                var          args         = new QueryArgs(featureClass, "point:[445190.8,4471328.55]", new[] { "NAME" }, "");

                var client = new HttpClient();
                var url    = "http://localhost:6080/arcgis/rest/services/Soe/SearchApi/MapServer/exts/Search/Search?{0}&f=json"
                             .With(args.ToQueryString());

                var response = client.GetAsync(url);
                var result   = response.Result.Content.ReadAsStringAsync().Result;

                Assert.That(result, Is.Not.Null);
                Assert.That(result, Does.StartWith("{\"Results\":[]").IgnoreCase);
            }
Пример #3
0
            public void SpatialQueryDatabaseForShape()
            {
                const string featureClass = "SGID93.BOUNDARIES.Counties";
                var          args         = new QueryArgs(featureClass, "point:[314755, 4609130]", new[] { "shape@" }, "");

                var client = new HttpClient();
                var url    =
                    "http://localhost:6080/arcgis/rest/services/Soe/SearchApi/MapServer/exts/Search/Search?{0}&f=json".
                    With(args.ToQueryString());

                var response = client.GetAsync(url);
                var result   = response.Result.Content.ReadAsStringAsync().Result;

                Assert.That(result, Is.Not.Null);
                Assert.That(result, Does.StartWith("{\"Results\":[{\"Geometry\":\"{\\\"rings\\\":[[[").IgnoreCase);
            }
Пример #4
0
            public void ReturnsErrorWhenFeatureClassDoesNotExist()
            {
                const string featureClass = "SGID93.Schema.Fake";
                var          args         = new QueryArgs(featureClass, "", new[] { "name" }, "");

                var client = new HttpClient();
                var url    =
                    "http://localhost:6080/arcgis/rest/services/Soe/SearchApi/MapServer/exts/Search/Search?{0}&f=json".
                    With(args.ToQueryString());

                var response = client.GetAsync(url);
                var result   = response.Result.Content.ReadAsStringAsync().Result;

                Assert.That(result, Is.Not.Null);
                Assert.That(result,
                            Is.EqualTo("{\"error\":{\"code\":400,\"message\":\"DBMS table not found\"}}").IgnoreCase);
            }
Пример #5
0
            public void SpatialQueryDatabaseWithWhereClause()
            {
                const string featureClass = "SGID93.Boundaries.Counties";
                var          args         = new QueryArgs(featureClass, "point:[314755, 4609130]", new[] { "NAME, FIPS" },
                                                          "name = 'not found'");

                var client = new HttpClient();
                var url    =
                    "http://localhost:6080/arcgis/rest/services/Soe/SearchApi/MapServer/exts/Search/Search?{0}&f=json".
                    With(args.ToQueryString());

                var response = client.GetAsync(url);
                var result   = response.Result.Content.ReadAsStringAsync().Result;

                Assert.That(result, Is.Not.Null);
                Assert.That(result, Does.StartWith("{\"Results\":[]").IgnoreCase);
            }
Пример #6
0
            public void ReturnsErrorWhenFeatureClassDoesNotExist()
            {
                const string featureClass = "SGID93.Schema.Fake";
                var args = new QueryArgs(featureClass, "", new[] {"name"}, "");

                var client = new HttpClient();
                var url =
                    "http://localhost:6080/arcgis/rest/services/Soe/SearchApi/MapServer/exts/Search/Search?{0}&f=json".
                        With(args.ToQueryString());

                var response = client.GetAsync(url);
                var result = response.Result.Content.ReadAsStringAsync().Result;

                Assert.That(result, Is.Not.Null);
                Assert.That(result,
                            Is.EqualTo("{\"error\":{\"code\":400,\"message\":\"DBMS table not found\"}}").IgnoreCase);
            }
Пример #7
0
            public void SpatialQueryDatabaseForAttribute()
            {
                const string featureClass = "SGID93.BOUNDARIES.Counties";
                var args = new QueryArgs(featureClass, "point:[314755, 4609130]", new[] {"NAME"}, "");

                var client = new HttpClient();
                var url =
                    "http://localhost:6080/arcgis/rest/services/Soe/SearchApi/MapServer/exts/Search/Search?{0}&f=json".
                        With(args.ToQueryString());

                var response = client.GetAsync(url);
                var result = response.Result.Content.ReadAsStringAsync().Result;

                Assert.That(result, Is.Not.Null);
                Assert.That(result,
                            Is.StringStarting(
                                "{\"Results\":[{\"Geometry\":null,\"Attributes\":{\"Name\":\"Box Elder\"}}]").IgnoreCase);
            }
Пример #8
0
            public void SpatialQueryDatabaseWithWhereClause()
            {
                const string featureClass = "SGID93.Boundaries.Counties";
                var args = new QueryArgs(featureClass, "point:[314755, 4609130]", new[] {"NAME, FIPS"},
                                         "name = 'not found'");

                var client = new HttpClient();
                var url =
                    "http://localhost:6080/arcgis/rest/services/Soe/SearchApi/MapServer/exts/Search/Search?{0}&f=json".
                        With(args.ToQueryString());

                var response = client.GetAsync(url);
                var result = response.Result.Content.ReadAsStringAsync().Result;

                Assert.That(result, Is.Not.Null);
                Assert.That(result, Is.StringStarting("{\"Results\":[]").IgnoreCase);
            }
        public void ConvertToqueryString()
        {
            var args = new QueryArgs("test", new[] { "a", "b" }, "me");

            Assert.That(args.ToQueryString(), Is.EqualTo("featureClass=test&returnValues=a%2Cb&predicate=me"));
        }