public void ShouldFindOverloadWithNullParam() { var box = new Box { Width = 10, Height = 20 }; var jint = CreateContext(Assert.Fail); jint.SetFunction("assert", new Action<object, object, string>(Assert.AreEqual)); jint.SetParameter("box", box); jint.Execute(@" assert(1, Number(box.Foo(1))); assert(2, Number(box.Foo(2, null))); "); }
public void ShouldEvaluateIndexersAsClrFields() { var box = new Box { width = 10, height = 20 }; var jint = CreateContext(Assert.Fail); jint.SetParameter("box", box); Assert.AreEqual(10, jint.Execute("return box.width")); Assert.AreEqual(10, jint.Execute("return box['width']")); jint.Execute("box['height'] = 30;"); Assert.AreEqual(30, box.height); jint.Execute("box.height = 18;"); Assert.AreEqual(18, box.height); }