public void TestFwCore () { var fwCore = new FwCore (); fwCore.Location = new Location (52.365299224853516, 9.6899404525756836); fwCore.Category = "restaurant"; var source = new Source (); source.Name = "OpenStreetMap"; source.WebSite = @"http://www.openstreetmap.org"; source.Licence = @"http://www.openstreetmap.org/copyright"; fwCore.Source = source; fwCore.Name = "Mi Pueblito"; fwCore.Description = "no steps, to wheelchair toilets"; fwCore.LastUpdate = new LastUpdate ("x", 1234); string jsonLocationString = @"""location"":{""wgs84"":{""latitude"":52.365299224853516,""longitude"":9.6899404525756836}}"; string jsonLastUpdateString = @"""last_update"":{""timestamp"":1234,""responsible"":""x""}"; string jsonNameString = @"""name"":{"""":""Mi Pueblito""}"; string jsonDescrString = @"""description"":{"""":""no steps, to wheelchair toilets""}"; string jsonCatString = @"""category"":""restaurant"""; string jsonSourceString = @"""source"":{""name"":""OpenStreetMap"",""website"":""http://www.openstreetmap.org"",""license"":""http://www.openstreetmap.org/copyright""}"; string jsonFwCore = string.Format ("{0},{1},{2},{3},{4},{5}", jsonLocationString, jsonSourceString, jsonNameString, jsonCatString, jsonDescrString, jsonLastUpdateString); jsonFwCore = "{" + jsonFwCore + "}"; var fwCoreObject = MiniJSON.Json.Deserialize (jsonFwCore); var fwCoreDeserialized = new FwCore (fwCoreObject); Assert.AreEqual (fwCoreDeserialized, fwCore); var fwCoreSerialized = fwCore.ToDictionary (); var fwCoreJsonSerialized = MiniJSON.Json.Serialize (fwCoreSerialized); Assert.AreEqual (jsonFwCore, fwCoreJsonSerialized); }
public void TestSource () { var source = new Source ("OpenStreetMap", @"http://www.openstreetmap.org", @"http://www.openstreetmap.org/copyright"); string jsonSource = @"{""name"":""OpenStreetMap"",""website"":""http://www.openstreetmap.org"",""license"":""http://www.openstreetmap.org/copyright""}"; var sourceObject = MiniJSON.Json.Deserialize (jsonSource); var sourceDeserialized = new Source (sourceObject); Assert.AreEqual (source, sourceDeserialized); var sourceSerialized = source.ToDictionary (); var sourceJsonSerialized = MiniJSON.Json.Serialize (sourceSerialized); Assert.AreEqual (jsonSource, sourceJsonSerialized); }