I want to use DynamicObject class under Jint and I have built a sample to do it. First assert is correctly passes but fails at second assert.
Is there any way to do it or do you know any other javascript engine that makes it possible ?
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;");
// result is null here
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;
}
}