Exemplo n.º 1
0
        public void Compile_Dynamic_Invoke()
        {
            object value = 1;
            Expression <Func <bool> > expression = () => value is int;

            Assert.Equal(value is int, ExpressionProcessor.Compile(expression));
        }
Exemplo n.º 2
0
        public void Compile_Member()
        {
            int value = 1;
            Expression <Func <object> > expression = () => value;

            Assert.Equal(value, ExpressionProcessor.Compile(expression));
        }
Exemplo n.º 3
0
        public void Compile_BinaryExpression_Dynamic_Invoke()
        {
            Person person = new Person()
            {
                Id = 1
            };
            Expression <Func <int> > expression = () => person.Id << 2;

            Assert.Equal(person.Id << 2, ExpressionProcessor.Compile((BinaryExpression)expression.Body));
        }
Exemplo n.º 4
0
        public void Compile_New_List()
        {
            Expression <Func <object> > expression = () => new List <int> {
                1, 2, 3
            };

            Assert.Equal(new List <int> {
                1, 2, 3
            }, ExpressionProcessor.Compile(expression));
        }
Exemplo n.º 5
0
        public void Compile_New_Array()
        {
            Expression <Func <object> > expression = () => new byte[] { 1, 2, 3 };

            Assert.Equal(new byte[] { 1, 2, 3 }, ExpressionProcessor.Compile(expression));
        }
Exemplo n.º 6
0
        public void Compile_New()
        {
            Expression <Func <object> > expression = () => new DateTime();

            Assert.Equal(new DateTime(), ExpressionProcessor.Compile(expression));
        }
Exemplo n.º 7
0
        public void Compile_Constant()
        {
            Expression <Func <object> > expression = () => 1;

            Assert.Equal(1, ExpressionProcessor.Compile(expression));
        }