예제 #1
0
        public void EvaluateSimpleNewArrayExpression()
        {
            IExpression expression = new NewArrayExpression("System.Int32", new IExpression[] { new ConstantExpression(10) });

            object result = expression.Evaluate(new BindingEnvironment());

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(int[]));

            int[] array = (int[])result;

            Assert.AreEqual(10, array.Length);
        }
예제 #2
0
        public void EvaluateSimpleNewIClassicObjectArrayExpression()
        {
            BindingEnvironment environment = new BindingEnvironment();

            environment.SetValue("ADynamicClass", new DynamicClass("ADynamicClass"));

            IExpression expression = new NewArrayExpression("ADynamicClass", new IExpression[] { new ConstantExpression(10) });

            object result = expression.Evaluate(environment);

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(IClassicObject[]));

            IClassicObject[] array = (IClassicObject[])result;

            Assert.AreEqual(10, array.Length);
        }