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