Exemplo n.º 1
0
        public static void VerifyMakeUnaryDeduceMethodIsTrueBool(Truthiness argument, bool expected, bool useInterpreter)
        {
            Expression <Func <bool> > e =
                Expression.Lambda <Func <bool> >(
                    Expression.MakeUnary(
                        ExpressionType.IsTrue, Expression.Constant(argument), null, null));
            Func <bool> f = e.Compile(useInterpreter);

            Assert.Equal(expected, f());
        }
Exemplo n.º 2
0
        private static void VerifyMakeUnaryExplicitMethodIsTrueBool(Truthiness argument, bool expected, bool useInterpreter)
        {
            Expression <Func <bool> > e =
                Expression.Lambda <Func <bool> >(
                    Expression.MakeUnary(
                        ExpressionType.IsTrue, Expression.Constant(argument), null, typeof(Truthiness).GetMethod("op_True")));
            Func <bool> f = e.Compile(useInterpreter);

            Assert.Equal(expected, f());
        }