public void Engine_Dynamic_Method_Returns()
        {
            using (var engine = new JsEngine())
            {
                var testLib = new TestLibrary();
                engine.AddLibrary("Dynamic", testLib);

                engine.Execute("Dynamic = lib('Dynamic');");
                Assert.Equal(true, engine.InternalEngine.HasGlobalValue("Dynamic"));

                var result = engine.Evaluate <string>("Dynamic.Method()");

                Assert.Equal(testLib.Method(), result.Value);
            }
        }
Beispiel #2
0
        public void Engine_Dynamic_Method_Returns()
        {
            var eng = new JsEngine();

            using (var engine = eng.CreateExecutionContext())
            {
                var testLib = new TestLibrary();
                engine.AddLibrary("Dynamic", testLib);

                engine.Execute("Dynamic = require('Dynamic');");
                Assert.NotNull(engine.Resolve("Dynamic"));

                var result = engine.Evaluate <string>("Dynamic.Method()");

                Assert.Equal(testLib.Method(), result.Value);
            }
        }
        public void Engine_Dynamic_Method_Returns()
        {
            using (var engine = new JsEngine())
            {
                var testLib = new TestLibrary();
                engine.AddLibrary("Dynamic", testLib);

                engine.Execute("Dynamic = lib('Dynamic');");
                Assert.Equal(true, engine.InternalEngine.HasGlobalValue("Dynamic"));

                var result = engine.Evaluate<string>("Dynamic.Method()");

                Assert.Equal(testLib.Method(), result.Value);
            }
        }