Exemple #1
0
        public void GenericParseWorks3()
        {
            var o = (TestClass3)Bridge.Html5.JSON.Parse("{ \"i\": 3, \"s\": \"test\" }");

            Assert.AreEqual(3, o.i);
            Assert.AreEqual("test", o.s);
            Assert.AreEqual(4, o.Inc());
            Assert.AreEqual(11, TestClass3.Inc(10));
            Assert.True(IsPlainObject(o), "IsPlainObject");
        }
Exemple #2
0
        public void GenericParseWithCallbackWorks3()
        {
            var o = (TestClass3)Bridge.Html5.JSON.Parse("{ \"i\": 3, \"s\": \"test\" }", (s, x) => { if (s == "i")
                                                                                                     {
                                                                                                         return(100);
                                                                                                     }
                                                                                                     return(x); });

            Assert.AreEqual(100, o.i);
            Assert.AreEqual("test", o.s);
            Assert.AreEqual(101, o.Inc());
            Assert.AreEqual(11, TestClass3.Inc(10));
            Assert.True(IsPlainObject(o), "IsPlainObject");
        }