public void VInterop_TestSelfDescribingType() { UserData.UnregisterType <SelfDescribingClass>(); string script = @" a = myobj[1]; b = myobj[2]; c = myobj[3]; return a + b + c; " ; Script S = new Script(); SelfDescribingClass obj = new SelfDescribingClass(); UserData.UnregisterType <SelfDescribingClass>(); UserData.RegisterType <SelfDescribingClass>(); S.Globals.Set("myobj", UserData.Create(obj)); DynValue res = S.DoString(script); Assert.AreEqual(DataType.Number, res.Type); Assert.AreEqual(18, res.Number); }
public void Interop_TestSelfDescribingType() { UserData.UnregisterType<SelfDescribingClass>(); string script = @" a = myobj[1]; b = myobj[2]; c = myobj[3]; return a + b + c; "; Script S = new Script(); SelfDescribingClass obj = new SelfDescribingClass(); UserData.UnregisterType<SelfDescribingClass>(); UserData.RegisterType<SelfDescribingClass>(); S.Globals.Set("myobj", UserData.Create(obj)); DynValue res = S.DoString(script); Assert.AreEqual(DataType.Number, res.Type); Assert.AreEqual(18, res.Number); }