Пример #1
0
        public void EvaluateUndefined()
        {
            TypeOfExpression expr = new TypeOfExpression(new VariableExpression("foo"));
            var result = expr.Evaluate(new Context());

            Assert.IsNotNull(result);
            Assert.AreEqual("undefined", result);
        }
Пример #2
0
        public void EvaluateReal()
        {
            TypeOfExpression expr = new TypeOfExpression(new ConstantExpression(Math.PI));
            var result = expr.Evaluate(null);

            Assert.IsNotNull(result);
            Assert.AreEqual("number", result);
        }
Пример #3
0
        public void EvaluateString()
        {
            TypeOfExpression expr = new TypeOfExpression(new ConstantExpression("foo"));
            var result = expr.Evaluate(null);

            Assert.IsNotNull(result);
            Assert.AreEqual("string", result);
        }
Пример #4
0
        public void EvaluateArray()
        {
            TypeOfExpression expr = new TypeOfExpression(new VariableExpression("foo"));
            Context ctx = new Context();
            ctx.SetValue("foo", (new ArrayFunction(ctx)).NewInstance(new object[] { }));
            var result = expr.Evaluate(ctx);

            Assert.IsNotNull(result);
            Assert.AreEqual("object", result);
        }