@@ -29,5 +29,41 @@ public void Can_Deserialize_When_Json_Does_Not_Contain_Crs_Property()
2929 Assert . IsNull ( point . CRS ) ;
3030 }
3131
32+ [ Test ]
33+ public void Can_Deserialize_CRS_issue_89 ( )
34+ {
35+ var json = "{\" coordinates\" : [ 90.65464646, 53.2455662, 200.4567 ], \" type\" : \" Point\" , \" crs\" : { \" type\" : \" name\" , \" properties\" : { \" name\" : \" urn:ogc:def:crs:OGC:1.3:CRS84\" }}}" ;
36+
37+ var point = JsonConvert . DeserializeObject < Point > ( json ) ;
38+
39+ Assert . IsNotNull ( point . CRS ) ;
40+ Assert . AreEqual ( CRSType . Name , point . CRS . Type ) ;
41+ }
42+
43+ [ Test ]
44+ public void Can_Serialize_CRS_issue_89 ( )
45+ {
46+ var expected =
47+ "{\" type\" :\" Point\" ,\" coordinates\" :[34.56,12.34],\" crs\" :{\" properties\" :{\" name\" :\" TEST NAME\" },\" type\" :\" name\" }}" ;
48+ var point = new Point ( new Position ( 12.34 , 34.56 ) ) { CRS = new NamedCRS ( "TEST NAME" ) } ;
49+
50+ var json = JsonConvert . SerializeObject ( point ) ;
51+
52+ Assert . IsNotNull ( json ) ;
53+ Assert . AreEqual ( expected , json ) ;
54+ }
55+
56+ [ Test ]
57+ public void Can_Serialize_DefaultCRS_issue_89 ( )
58+ {
59+ var expected =
60+ "{\" type\" :\" Point\" ,\" coordinates\" :[34.56,12.34],\" crs\" :{\" properties\" :{\" name\" :\" urn:ogc:def:crs:OGC::CRS84\" },\" type\" :\" name\" }}" ;
61+ var point = new Point ( new Position ( 12.34 , 34.56 ) ) { CRS = new NamedCRS ( "urn:ogc:def:crs:OGC::CRS84" ) } ;
62+
63+ var json = JsonConvert . SerializeObject ( point ) ;
64+
65+ Assert . IsNotNull ( json ) ;
66+ Assert . AreEqual ( expected , json ) ;
67+ }
3268 }
3369}
0 commit comments