Beispiel #1
0
        public void CompileAny_NoExpressions_InvalidOperationException()
        {
            // arrange
            var errExpr = new Expression <Func <int, int, int> >[] { };

            // action
            var fun = ScalarPrimitives <int, int> .CompileAny(errExpr);
        }
Beispiel #2
0
        public void CompileAny_UsingAdd_ReturnFunctionToAdd()
        {
            // arrange
            var paramA = Expression.Parameter(typeof(int), "a");
            var paramB = Expression.Parameter(typeof(int), "b");

            var exps = new[] { Expression.Lambda <Func <int, int, int> >(Expression.Add(paramA, paramB), paramA, paramB) };

            // action
            var fun = ScalarPrimitives <int, int> .CompileAny(exps);

            var result = fun(1, 2);

            // assert
            Assert.AreEqual(3, result);
        }