Esempio n. 1
0
        public void TestAppManifestOkSerialization()
        {
            var mfstOk = new AppManifestOk();
            mfstOk.InstanceId = "inst101";
            string json = mfstOk.Serialize();

            Assert.IsTrue(json.IndexOf("\"instanceId\":\"inst101\"") > 0, "Should have inst101 for instanceId");
        }
Esempio n. 2
0
 public Create(AppManifest manifest, AppInstance instance)
 {
     this.manifest = manifest;
     this.instance = instance;
     this.okMsg = new AppManifestOk();
     this.okMsg.InstanceId = manifest.InstanceId != null ? manifest.InstanceId : instance.InstanceId;
     this.Log = Logger.GetInstance();
 }
Esempio n. 3
0
 public static new DataPacket Deserialize(string json)
 {
     try
     {
         var ret = new AppManifestOk();
         dynamic obj = Json.Decode(json);
         ret.InstanceId = obj["instanceId"];
         if (ret.InstanceId == null)
         {
             throw new ParseException(json, "Does not contain instanceId");
         }
         return ret;
     }
     catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException)
     {
         throw new ParseException(json, "General binding exception, is instanceId valid?");
     }
     catch (ArgumentException)
     {
         throw new ParseException(json, "Invalid JSON");
     }
 }