Skip to content

Commit

Permalink
add a test case: deserializing a feature without any properties
Browse files Browse the repository at this point in the history
  • Loading branch information
janusw committed Feb 14, 2024
1 parent 102a7b8 commit 2da16a7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/GeoJSON.Net.Tests/Feature/FeatureTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ public void Can_Deserialize_Point_Feature()
Assert.AreEqual(GeoJSONObjectType.Point, feature.Geometry.Type);
}

[Test]
public void Can_Deserialize_Feature_Without_Props()
{
var json = GetExpectedJson();

var feature = JsonConvert.DeserializeObject<Net.Feature.Feature>(json);

Assert.IsNotNull(feature);
Assert.IsNotNull(feature.Properties);
Assert.IsEmpty(feature.Properties);

Assert.AreEqual(GeoJSONObjectType.Polygon, feature.Geometry.Type);
}

[Test]
public void Can_Serialize_LineString_Feature()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[ 4.8892593383789062, 52.370725881211314 ],
[ 4.8952674865722656, 52.3711451105601 ],
[ 4.8920917510986328, 52.369310952782627 ],
[ 4.8892593383789062, 52.370725881211314 ]
]
]
}
}

0 comments on commit 2da16a7

Please sign in to comment.