-
-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
2 changed files
with
46 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using GeoJSON.Net.Converters; | ||
using GeoJSON.Net.Geometry; | ||
using Newtonsoft.Json; | ||
using NUnit.Framework; | ||
|
||
namespace GeoJSON.Net.Tests.Serialization | ||
{ | ||
public class JsonTests | ||
{ | ||
[Test] | ||
public void Can_Serialize_as_GeoJSONObject() | ||
{ | ||
GeoJSONObject source = new Point(new Position(10, 20)); | ||
|
||
var json = JsonConvert.SerializeObject(source, new GeoJsonConverter()); | ||
|
||
var deserialized = JsonConvert.DeserializeObject<GeoJSONObject>(json, new GeoJsonConverter()); | ||
|
||
Assert.AreEqual(source, deserialized); | ||
} | ||
|
||
[Test] | ||
public void Can_Serialize_as_IGeoJSONObject() | ||
{ | ||
IGeoJSONObject source = new Point(new Position(10, 20)); | ||
|
||
var json = JsonConvert.SerializeObject(source, new GeoJsonConverter()); | ||
|
||
var deserialized = JsonConvert.DeserializeObject<IGeoJSONObject>(json, new GeoJsonConverter()); | ||
|
||
Assert.AreEqual(source, deserialized); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters