Skip to content

Commit 8fd4ad6

Browse files
committed
Rename GeoShapeQueryUsageTests
This commit renames GeoShapeQueryUsageTests to GeoShapeSerializationTests and removes the separate serialization unit tests as these will be covered by the integration test. This is so that these tests do not appear in documentation. Rename _coordinates to _polygonCoordinates and add a sample to subsititutes for documentation. This test also sets IgnoreUnmapped.
1 parent 41c586f commit 8fd4ad6

File tree

4 files changed

+13
-22
lines changed

4 files changed

+13
-22
lines changed

src/CodeGeneration/DocGenerator/StringExtensions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ public static string[] SplitOnNewLines(this string input, StringSplitOptions opt
161161
{ "Script.Map", "\"if (doc['state'].value == \\\"Stable\\\") { params._agg.commits.add(doc['numberOfCommits'].value) }\"" },
162162
{ "Script.Combine", "\"def sum = 0.0; for (c in params._agg.commits) { sum += c } return sum\"" },
163163
{ "Script.Reduce", "\"def sum = 0.0; for (a in params._aggs) { sum += a } return sum\"" },
164+
{ "this._polygonCoordinates", @"new[]{
165+
new []{ new [] {10.0, -17.0}, new [] {15.0, 16.0}, new [] {0.0, 12.0}, new [] {-15.0, 16.0}, new [] {-10.0, -17.0},new [] {10.0, -17.0}},
166+
new []{ new [] {8.2, 18.2}, new [] {8.2, -18.8}, new [] {-8.8, -10.8}, new [] {8.8, 18.2}}
167+
}"
168+
}
164169
};
165170

166171
public static bool TryGetJsonForAnonymousType(this string anonymousTypeString, out string json)

src/Tests/Framework/SerializationTests/GeoShapeSerializationTests.cs

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/Tests/QueryDsl/Geo/GeoShapeQueryUsageTests.cs renamed to src/Tests/QueryDsl/Geo/GeoShapeSerializationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
namespace Tests.QueryDsl.Geo
1212
{
13-
public class GeoShapeQueryUsageTests :
13+
public class GeoShapeSerializationTests :
1414
ApiIntegrationTestBase<IntrusiveOperationCluster,
1515
ISearchResponse<Framework.MockData.Shape>,
1616
ISearchRequest,
1717
SearchDescriptor<Framework.MockData.Shape>,
1818
SearchRequest<Framework.MockData.Shape>>
1919
{
20-
public GeoShapeQueryUsageTests(IntrusiveOperationCluster cluster, EndpointUsage usage)
20+
public GeoShapeSerializationTests(IntrusiveOperationCluster cluster, EndpointUsage usage)
2121
: base(cluster, usage) { }
2222

2323
private const string Index = "shapes";

src/Tests/QueryDsl/Geo/Shape/Polygon/GeoShapePolygonQueryUsageTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class GeoShapePolygonQueryUsageTests : QueryDslUsageTestsBase
1111
{
1212
public GeoShapePolygonQueryUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
1313

14-
private readonly IEnumerable<IEnumerable<GeoCoordinate>> _coordinates = new[]
14+
private readonly IEnumerable<IEnumerable<GeoCoordinate>> _polygonCoordinates = new[]
1515
{
1616
new GeoCoordinate[]
1717
{
@@ -36,7 +36,7 @@ public GeoShapePolygonQueryUsageTests(ReadOnlyCluster i, EndpointUsage usage) :
3636
shape = new
3737
{
3838
type = "polygon",
39-
coordinates = this._coordinates
39+
coordinates = this._polygonCoordinates
4040
}
4141
}
4242
}
@@ -47,19 +47,19 @@ public GeoShapePolygonQueryUsageTests(ReadOnlyCluster i, EndpointUsage usage) :
4747
Name = "named_query",
4848
Boost = 1.1,
4949
Field = Field<Project>(p => p.Location),
50-
#pragma warning disable 618 // use of IgnoreUnmapped
51-
Shape = new PolygonGeoShape(this._coordinates) { IgnoreUnmapped = true },
52-
#pragma warning restore 618
50+
Shape = new PolygonGeoShape(this._polygonCoordinates),
5351
Relation = GeoShapeRelation.Intersects,
52+
IgnoreUnmapped = true
5453
};
5554

5655
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
5756
.GeoShapePolygon(c => c
5857
.Name("named_query")
5958
.Boost(1.1)
6059
.Field(p => p.Location)
61-
.Coordinates(this._coordinates, ignoreUnmapped: true)
60+
.Coordinates(this._polygonCoordinates)
6261
.Relation(GeoShapeRelation.Intersects)
62+
.IgnoreUnmapped(true)
6363
);
6464

6565
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<IGeoShapePolygonQuery>(a => a.GeoShape as IGeoShapePolygonQuery)

0 commit comments

Comments
 (0)