public void Initialize() { testFunctionsMock = new Mock <TestFunctions>(); Context = new JSContext(); Context.GetGlobalObject().SetProperty("simpleProperties", new SimpleProperties() { stringProperty = "stringPropertyValue", intProperty = 3, floatProperty = (float)Math.PI, doubleProperty = GOLDEN_RATIO, boolProperty = true, floatsProperty = new float[] { 3.14f, 16 / 9 }, dictProperty = new Dictionary <object, object>() { { "123", 2 }, { "string", "hello world" } }, nonGenericDictionary = new Dictionary <string, object>() { { "x", 1 } }, nestedProperty = testFunctionsMock.Object }); Context.GetGlobalObject().SetProperty("testFunctions", testFunctionsMock.Object); }
private void CreateWindowScriptObject(JSContext context) { if (ObjectForScripting != null && context != null) { JSObject global = context.GetGlobalObject(); JSObject window = global.GetProperty("window") as JSObject; if (window != null) { window.SetProperty("external", (object)ObjectForScripting); } } }
public void Initialize() { testFunctionsMock = new Mock<TestFunctions>(); Context = new JSContext(); Context.GetGlobalObject().SetProperty("simpleProperties", new SimpleProperties() { stringProperty = "stringPropertyValue", intProperty = 3, floatProperty = (float)Math.PI, doubleProperty = GOLDEN_RATIO, boolProperty = true, floatsProperty = new float[] { 3.14f, 16/9 }, dictProperty = new Dictionary<object,object>() { {"123", 2}, {"string", "hello world"} }, nonGenericDictionary = new Dictionary<string, object>() { { "x", 1 } }, nestedProperty = testFunctionsMock.Object }); Context.GetGlobalObject().SetProperty("testFunctions", testFunctionsMock.Object); }
private void CreateWindowScriptObject(JSContext context) { if (ObjectForScripting != null && context != null) { JSObject global = context.GetGlobalObject(); JSValue window = global.GetProperty("window"); if (window == null || !window.IsObject) { return; } JSObject windowObj = window.ToObject(); if (windowObj == null) { return; } windowObj.SetProperty("external", (object)ObjectForScripting); } }
private void CreateWindowScriptObject(JSContext context) { if (ObjectForScripting != null && context != null) { JSObject global = context.GetGlobalObject(); JSObject window = global.GetProperty("window") as JSObject; if (window != null) window.SetProperty("external", (object)ObjectForScripting); } }
public void FixtureSetup() { Context = new JSContext(); Context.GetGlobalObject().SetProperty("tests", new TestGlobalObject()); }
private void CreateWindowScriptObject(JSContext context) { if (ObjectForScripting != null && context != null) { JSObject global = context.GetGlobalObject(); JSValue window = global.GetProperty("window"); if (window == null || !window.IsObject) { return; } JSObject windowObj = window.ToObject(); if (windowObj == null) { return; } windowObj.SetProperty("external", ObjectForScripting); } }