Skip to content

Commit 2da16a7

Browse files
committed
add a test case: deserializing a feature without any properties
1 parent 102a7b8 commit 2da16a7

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/GeoJSON.Net.Tests/Feature/FeatureTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,20 @@ public void Can_Deserialize_Point_Feature()
2929
Assert.AreEqual(GeoJSONObjectType.Point, feature.Geometry.Type);
3030
}
3131

32+
[Test]
33+
public void Can_Deserialize_Feature_Without_Props()
34+
{
35+
var json = GetExpectedJson();
36+
37+
var feature = JsonConvert.DeserializeObject<Net.Feature.Feature>(json);
38+
39+
Assert.IsNotNull(feature);
40+
Assert.IsNotNull(feature.Properties);
41+
Assert.IsEmpty(feature.Properties);
42+
43+
Assert.AreEqual(GeoJSONObjectType.Polygon, feature.Geometry.Type);
44+
}
45+
3246
[Test]
3347
public void Can_Serialize_LineString_Feature()
3448
{
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"type": "Feature",
3+
"geometry": {
4+
"type": "Polygon",
5+
"coordinates": [
6+
[
7+
[ 4.8892593383789062, 52.370725881211314 ],
8+
[ 4.8952674865722656, 52.3711451105601 ],
9+
[ 4.8920917510986328, 52.369310952782627 ],
10+
[ 4.8892593383789062, 52.370725881211314 ]
11+
]
12+
]
13+
}
14+
}

0 commit comments

Comments
 (0)