private void TestRoundTrip <TCoordinates>(string expected, GeoJsonMultiPoint <TCoordinates> multiPoint) where TCoordinates : GeoJsonCoordinates { var json = multiPoint.ToJson(); Assert.AreEqual(expected, json); var rehydrated = BsonSerializer.Deserialize <GeoJsonMultiPoint <TCoordinates> >(json); Assert.AreEqual(expected, rehydrated.ToJson()); }
public void ToJson1() { GeoJsonMultiPoint mp = new GeoJsonMultiPoint { new GeoJsonCoordinates(10, 40), new GeoJsonCoordinates(40, 30), new GeoJsonCoordinates(20, 20), new GeoJsonCoordinates(30, 10) }; Assert.AreEqual(4, mp.Count); Assert.AreEqual("{\"type\":\"MultiPoint\",\"coordinates\":[[10.0,40.0],[40.0,30.0],[20.0,20.0],[30.0,10.0]]}", mp.ToJson(Formatting.None)); }