コード例 #1
0
        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);
        }
コード例 #2
0
		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);
		}