Skip to content

Commit 082660b

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 93a1756 commit 082660b

File tree

4 files changed

+12
-21
lines changed

4 files changed

+12
-21
lines changed

src/CodeGeneration/DocGenerator/StringExtensions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ public static string[] SplitOnNewLines(this string input, StringSplitOptions opt
156156
{ "Second.Init", "\"params._agg.commits = []\"" },
157157
{ "Second.Map", "\"if (doc['state'].value == \\\"Stable\\\") { params._agg.commits.add(doc['numberOfCommits'].value) }\"" },
158158
{ "Second.Reduce", "\"def sum = 0.0; for (a in params._aggs) { sum += a } return sum\"" },
159+
{ "this._polygonCoordinates", @"new[]{
160+
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}},
161+
new []{ new [] {8.2, 18.2}, new [] {8.2, -18.8}, new [] {-8.8, -10.8}, new [] {8.8, 18.2}}
162+
}"
163+
}
159164
};
160165

161166
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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class GeoShapePolygonQueryUsageTests : GeoShapeQueryUsageTestsBase
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
{
@@ -26,15 +26,15 @@ public GeoShapePolygonQueryUsageTests(ReadOnlyCluster i, EndpointUsage usage) :
2626
protected override object ShapeJson => new
2727
{
2828
type = "polygon",
29-
coordinates = this._coordinates
29+
coordinates = this._polygonCoordinates
3030
};
3131

3232
protected override QueryContainer QueryInitializer => new GeoShapePolygonQuery
3333
{
3434
Name = "named_query",
3535
Boost = 1.1,
3636
Field = Field<Project>(p => p.Location),
37-
Shape = new PolygonGeoShape(this._coordinates),
37+
Shape = new PolygonGeoShape(this._polygonCoordinates),
3838
Relation = GeoShapeRelation.Intersects,
3939
IgnoreUnmapped = false
4040
};
@@ -44,9 +44,9 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
4444
.Name("named_query")
4545
.Boost(1.1)
4646
.Field(p => p.Location)
47-
.Coordinates(this._coordinates)
47+
.Coordinates(this._polygonCoordinates)
4848
.Relation(GeoShapeRelation.Intersects)
49-
.IgnoreUnmapped()
49+
.IgnoreUnmapped(false)
5050
);
5151

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

0 commit comments

Comments
 (0)