Skip to content

Commit dc79003

Browse files
committed
Fix geo shape serialization tests
1 parent 52bac5c commit dc79003

File tree

10 files changed

+52
-39
lines changed

10 files changed

+52
-39
lines changed

src/Tests/QueryDsl/Geo/Shape/Circle/GeoShapeCircleUsageTests.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Tests.QueryDsl.Geo.Shape.Circle
77
{
8-
public class GeoShapeCircleUsageTests : ShapeQueryUsageTestsBase
8+
public class GeoShapeCircleUsageTests : GeoShapeQueryUsageTestsBase
99
{
1010
public GeoShapeCircleUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
1111

@@ -15,7 +15,6 @@ public GeoShapeCircleUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i
1515
{
1616
type ="circle",
1717
radius = "100m",
18-
ignore_unmapped = true,
1918
coordinates = this._coordinates
2019
};
2120

@@ -24,7 +23,7 @@ public GeoShapeCircleUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i
2423
Name = "named_query",
2524
Boost = 1.1,
2625
Field = Field<Project>(p=>p.Location),
27-
IgnoreUnmapped = true,
26+
IgnoreUnmapped = false,
2827
Shape = new CircleGeoShape(this._coordinates) { Radius = "100m" }
2928
};
3029

@@ -33,7 +32,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
3332
.Name("named_query")
3433
.Boost(1.1)
3534
.Field(p=>p.Location)
36-
.IgnoreUnmapped(true)
35+
.IgnoreUnmapped()
3736
.Coordinates(this._coordinates)
3837
.Radius("100m")
3938
);

src/Tests/QueryDsl/Geo/Shape/Envelope/GeoEnvelopeUsageTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Tests.QueryDsl.Geo.Shape.Envelope
88
{
9-
public class GeoEnvelopeUsageTests : ShapeQueryUsageTestsBase
9+
public class GeoEnvelopeUsageTests : GeoShapeQueryUsageTestsBase
1010
{
1111
public GeoEnvelopeUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
1212

@@ -19,7 +19,6 @@ public GeoEnvelopeUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, u
1919
protected override object ShapeJson => new
2020
{
2121
type ="envelope",
22-
ignore_unmapped = false,
2322
coordinates = this._coordinates
2423
};
2524

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Tests.Framework.Integration;
2+
using Xunit;
3+
4+
namespace Tests.QueryDsl
5+
{
6+
[Collection(TypeOfCluster.ReadOnly)]
7+
public abstract class GeoShapeQueryUsageTestsBase : QueryDslUsageTestsBase
8+
{
9+
public GeoShapeQueryUsageTestsBase(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
10+
11+
protected override object QueryJson => new
12+
{
13+
geo_shape = new
14+
{
15+
location = new
16+
{
17+
_name="named_query",
18+
boost = 1.1,
19+
ignore_unmapped = false,
20+
shape = this.ShapeJson
21+
}
22+
}
23+
};
24+
25+
protected abstract object ShapeJson { get; }
26+
}
27+
}

src/Tests/QueryDsl/Geo/Shape/LineString/GeoLineStringUsageTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Tests.QueryDsl.Geo.Shape.LineString
88
{
9-
public class GeoLineStringUsageTests : ShapeQueryUsageTestsBase
9+
public class GeoLineStringUsageTests : GeoShapeQueryUsageTestsBase
1010
{
1111
public GeoLineStringUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
1212

@@ -27,7 +27,8 @@ public GeoLineStringUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i,
2727
Name = "named_query",
2828
Boost = 1.1,
2929
Field = Field<Project>(p=>p.Location),
30-
Shape = new LineStringGeoShape(this._coordinates)
30+
Shape = new LineStringGeoShape(this._coordinates),
31+
IgnoreUnmapped = false
3132
};
3233

3334
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
@@ -36,6 +37,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
3637
.Boost(1.1)
3738
.Field(p=>p.Location)
3839
.Coordinates(this._coordinates)
40+
.IgnoreUnmapped()
3941
);
4042

4143
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<IGeoShapeLineStringQuery>(a => a.GeoShape as IGeoShapeLineStringQuery)

src/Tests/QueryDsl/Geo/Shape/MultiLineString/GeoMultiLineStringUsageTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Tests.QueryDsl.Geo.Shape.MultiLineString
88
{
9-
public class GeoMultiLineStringUsageTests : ShapeQueryUsageTestsBase
9+
public class GeoMultiLineStringUsageTests : GeoShapeQueryUsageTestsBase
1010
{
1111
public GeoMultiLineStringUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
1212

@@ -28,7 +28,8 @@ public GeoMultiLineStringUsageTests(ReadOnlyCluster i, EndpointUsage usage) : ba
2828
Name = "named_query",
2929
Boost = 1.1,
3030
Field = Field<Project>(p=>p.Location),
31-
Shape = new MultiLineStringGeoShape(this._coordinates)
31+
Shape = new MultiLineStringGeoShape(this._coordinates),
32+
IgnoreUnmapped = false
3233
};
3334

3435
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
@@ -37,6 +38,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
3738
.Boost(1.1)
3839
.Field(p=>p.Location)
3940
.Coordinates(this._coordinates)
41+
.IgnoreUnmapped()
4042
);
4143

4244
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<IGeoShapeMultiLineStringQuery>(a => a.GeoShape as IGeoShapeMultiLineStringQuery)

src/Tests/QueryDsl/Geo/Shape/MultiPoint/GeoMultiPointUsageTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Tests.QueryDsl.Geo.Shape.MultiPoint
88
{
9-
public class GeoMultiPointUsageTests : ShapeQueryUsageTestsBase
9+
public class GeoMultiPointUsageTests : GeoShapeQueryUsageTestsBase
1010
{
1111
public GeoMultiPointUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
1212

@@ -27,7 +27,8 @@ public GeoMultiPointUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i,
2727
Name = "named_query",
2828
Boost = 1.1,
2929
Field = Field<Project>(p=>p.Location),
30-
Shape = new MultiPointGeoShape(this._coordinates)
30+
Shape = new MultiPointGeoShape(this._coordinates),
31+
IgnoreUnmapped = false
3132
};
3233

3334
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
@@ -36,6 +37,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
3637
.Boost(1.1)
3738
.Field(p=>p.Location)
3839
.Coordinates(this._coordinates)
40+
.IgnoreUnmapped()
3941
);
4042

4143
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<IGeoShapeMultiPointQuery>(a => a.GeoShape as IGeoShapeMultiPointQuery)

src/Tests/QueryDsl/Geo/Shape/Point/GeoPointUsageTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Tests.QueryDsl.Geo.Shape.Point
77
{
8-
public class GeoPointUsageTests : ShapeQueryUsageTestsBase
8+
public class GeoPointUsageTests : GeoShapeQueryUsageTestsBase
99
{
1010
public GeoPointUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
1111

@@ -22,7 +22,8 @@ public GeoPointUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usag
2222
Name = "named_query",
2323
Boost = 1.1,
2424
Field = Field<Project>(p=>p.Location),
25-
Shape = new PointGeoShape(this._coordinates)
25+
Shape = new PointGeoShape(this._coordinates),
26+
IgnoreUnmapped = false
2627
};
2728

2829
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
@@ -31,6 +32,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
3132
.Boost(1.1)
3233
.Field(p=>p.Location)
3334
.Coordinates(this._coordinates)
35+
.IgnoreUnmapped()
3436
);
3537

3638
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<IGeoShapePointQuery>(a => a.GeoShape as IGeoShapePointQuery)

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Tests.QueryDsl.Geo.Shape.Polygon
88
{
9-
public class GeoPolygonUsageTests : ShapeQueryUsageTestsBase
9+
public class GeoPolygonUsageTests : GeoShapeQueryUsageTestsBase
1010
{
1111
public GeoPolygonUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
1212

@@ -33,7 +33,8 @@ public GeoPolygonUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, us
3333
Name = "named_query",
3434
Boost = 1.1,
3535
Field = Field<Project>(p => p.Location),
36-
Shape = new PolygonGeoShape(this._coordinates) { }
36+
Shape = new PolygonGeoShape(this._coordinates) { },
37+
IgnoreUnmapped = false
3738
};
3839

3940
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
@@ -42,6 +43,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
4243
.Boost(1.1)
4344
.Field(p => p.Location)
4445
.Coordinates(this._coordinates)
46+
.IgnoreUnmapped()
4547
);
4648

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

src/Tests/QueryDsl/Geo/Shape/ShapeQueryUsageTestsBase.cs

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

src/Tests/Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@
450450
<Compile Include=".\QueryDsl\Geo\Shape\MultiPoint\GeoMultiPointUsageTests.cs" />
451451
<Compile Include=".\QueryDsl\Geo\Shape\Point\GeoPointUsageTests.cs" />
452452
<Compile Include=".\QueryDsl\Geo\Shape\Polygon\GeoPolygonUsageTests.cs" />
453-
<Compile Include=".\QueryDsl\Geo\Shape\ShapeQueryUsageTestsBase.cs" />
453+
<Compile Include="QueryDsl\Geo\Shape\GeoShapeQueryUsageTestsBase.cs" />
454454
<Compile Include=".\QueryDsl\Joining\HasChild\HasChildQueryUsageTests.cs" />
455455
<Compile Include=".\QueryDsl\Joining\HasParent\HasParentQueryUsageTests.cs" />
456456
<Compile Include=".\QueryDsl\Joining\Nested\NestedQueryUsageTests.cs" />

0 commit comments

Comments
 (0)