I want to use the DynamicObject class under Jint , and I created a sample to execute it. The first statement passes correctly, but is not performed during the second statement.
Is there a way to do this, or do you know any other javascript mechanism that allows this to be done?
public void Jtest()
{
Jint.JintEngine engine = new JintEngine();
dynamic subject = new MyDynamicObject();
dynamic x = subject.myProp.otherProp;
Assert.AreEqual(subject, x);
engine.SetParameter("myClass", subject);
object result = engine.Run(@"return myClass.myProp.otherProp;");
Assert.AreEqual(subject, result);
}
public class MyDynamicObject : System.Dynamic.DynamicObject
{
public override bool TryGetMember(System.Dynamic.GetMemberBinder binder, out object result)
{
result = this;
return true;
}
}
ertan source
share