NewInstance() public method

public NewInstance ( object parameters ) : object
parameters object
return object
コード例 #1
0
        public void NewInstance()
        {
            ObjectFunction function = new ObjectFunction(null);
            object instance = function.NewInstance(null);

            Assert.IsNotNull(instance);
            Assert.IsInstanceOfType(instance, typeof(DynamicObject));
        }
コード例 #2
0
        public void EvaluateObject()
        {
            Context context = new Context();
            var objfn = new ObjectFunction(context);
            context.SetValue("Object", objfn);

            InstanceOfExpression expr = new InstanceOfExpression(new ConstantExpression(objfn.NewInstance(null)), new VariableExpression("Object"));
            var result = expr.Evaluate(context);

            Assert.IsNotNull(result);
            Assert.AreEqual(true, result);
        }