Esempio n. 1
0
        public void ShouldFindOverloadWithNullParam()
        {
            var box = new Box { Width = 10, Height = 20 };

            var jint = CreateJintEngine()
            .SetDebugMode(true)
            .SetFunction("assert", new Action<object, object>(Assert.AreEqual))
            .SetParameter("box", box);

            jint.Run(@"
                assert(1, Number(box.Foo(1)));
                assert(2, Number(box.Foo(2, null)));    
            ");
        }
Esempio n. 2
0
        public void ShouldEvaluateIndexersAsClrFields()
        {
            var box = new Box { width = 10, height = 20 };

            var jint = CreateJintEngine()
            .SetDebugMode(true)
            .SetParameter("box", box);

            Assert.AreEqual(10, jint.Run("return box.width"));
            Assert.AreEqual(10, jint.Run("return box['width']"));
            jint.Run("box['height'] = 30;");

            Assert.AreEqual(30, box.height);

            jint.Run("box.height = 18;");

            Assert.AreEqual(18, box.height);

        }