예제 #1
0
        public void TestMethodDeserializeComplex()
        {
            var f = new FuncHost();

            var functionName = "someFunction";
            var parameter = new Foo { Name = "Jonas" };

            f.Function<dynamic>(functionName, (param) => { return param.Name; });

            var result = f.InvokeAndSerialize("someFunction", "{Name:'Jonas'}");

            Assert.AreEqual("\"" + parameter.Name + "\"", result);
        }
예제 #2
0
        public void TestMethodSerialize()
        {
            var f = new FuncHost();

            var expect = "yoo";
            f.Function("foo", () => { return new Foo { Name = expect }; });
            var result = f.InvokeAndSerialize("foo", "");

            Assert.AreEqual("{\"Name\":\"yoo\"}", result);
        }