예제 #1
0
 protected override void SetupContext()
 {
     TestProxy.Inject(runtime);
     converter.RegisterArrayConverter <TestProxy>();
     context.GlobalObject.WriteProperty <TestProxy>("proxy", new TestProxy());
     runScript("ComplexProxy");
 }
예제 #2
0
        public void MultiProxyTransfer()
        {
            int size = 10;

            TestProxy[] items  = new TestProxy[size];
            string      target = string.Empty;

            for (int i = 0; i < items.Length; i++)
            {
                items[i] = new TestProxy(i.ToString());
                target   = target + i.ToString() + ",";
            }
            context.GlobalObject.WriteProperty <IEnumerable <TestProxy> >("proxies", items);

            var items_back = context.GlobalObject.ReadProperty <IEnumerable <TestProxy> >("proxies").ToArray();

            Assert.AreEqual(items_back.Length, items.Length);
            for (int i = 0; i < items.Length; i++)
            {
                Assert.AreSame(items[i], items_back[i]);
            }
            string result = context.GlobalObject.CallFunction <string>("MultiTransfer");

            Assert.AreEqual <string>(target, result);
        }
예제 #3
0
        public void ProxyCallback()
        {
            TestProxy stub = new TestProxy();

            context.GlobalObject.WriteProperty("myStub", stub);
            runScript("JSProxy");
            string s = context.GlobalObject.ReadProperty <string>("callProxyResult");

            Assert.AreEqual("hihi", s);
        }
예제 #4
0
        public void ProxyTransferback()
        {
            TestProxy stub = new TestProxy();

            context.GlobalObject.WriteProperty("a", stub);
            runScript("JSValueTest");
            TestProxy b = context.GlobalObject.ReadProperty <TestProxy>("b");

            Assert.IsTrue(object.ReferenceEquals(stub, b));
        }
예제 #5
0
 protected override void SetupContext()
 {
     TestProxy.Inject(runtime);
     context.GlobalObject.WriteProperty <TestProxy>("test", proxy);
     runScript("Promise");
 }
예제 #6
0
 protected override void SetupContext()
 {
     TestProxy.Inject(runtime);
 }