Example #1
0
 public ManifestFail(string message, AppInstance instance)
 {
     Fail = new AppManifestFail();
     Fail.Message = message;
     this.instance = instance;
     if (instance != null)
         instance.Issue(this);
 }
        public void TestAppManifestFailSerialization()
        {
            var appManifestFail = new AppManifestFail();
            appManifestFail.Message = "foo1";
            var json = appManifestFail.Serialize();

            Assert.IsTrue(json.IndexOf("\"message\":\"foo1\"") > 0, "should have a message foo1");
        }
Example #3
0
 public static new DataPacket Deserialize(string json)
 {
     try
     {
         var ret = new AppManifestFail();
         var obj = Json.Decode(json);
         ret.Message = obj["message"];
         if (ret.Message == null)
         {
             throw new ParseException(json, "Did not contain 'message'");
         }
         return ret;
     }
     catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException)
     {
         // NOTE: this probably should never be caught because obj["foo"], when foo doesn't exist,
         // just returns null and doesnt throw an exception. But I'm keeping this just in case.
         throw new ParseException(json, "Did not contain 'message'");
     }
     catch (ArgumentException)
     {
         throw new ParseException(json, "Invalid JSON");
     }
 }