public void TestAppInUseSerialization() { var appInUse = new AppInUse(); appInUse.Priority = 10; string json = appInUse.Serialize(); System.Diagnostics.Debug.WriteLine(json); Assert.IsTrue(json.IndexOf("\"priority\":10") > 0, "should have priority 10"); }
public static new DataPacket Deserialize(string json) { try { var ret = new AppInUse(); var obj = Json.Decode(json); ret.Priority = obj["priority"]; return ret; } catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException) { throw new ParseException(json, "'priority' was not found"); } catch (System.ArgumentException) { throw new ParseException(json, "Invalid JSON"); } }