protected override void SetupContext() { TestProxy.Inject(runtime); converter.RegisterArrayConverter <TestProxy>(); context.GlobalObject.WriteProperty <TestProxy>("proxy", new TestProxy()); runScript("ComplexProxy"); }
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); }
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); }
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)); }
protected override void SetupContext() { TestProxy.Inject(runtime); context.GlobalObject.WriteProperty <TestProxy>("test", proxy); runScript("Promise"); }
protected override void SetupContext() { TestProxy.Inject(runtime); }