Пример #1
0
        public static void CustomOpDecrement(Decrementable operand, Decrementable expected, bool useInterpreter)
        {
            Func <Decrementable> func = Expression.Lambda <Func <Decrementable> >(
                Expression.Decrement(Expression.Constant(operand))).Compile(useInterpreter);

            Assert.Equal(expected.Value, func().Value);
        }
Пример #2
0
        public static void UserDefinedOpDecrement(Decrementable operand, Decrementable expected, bool useInterpreter)
        {
            MethodInfo           method = typeof(IncrementDecrementTests).GetMethod(nameof(DoublyDecrement));
            Func <Decrementable> func   = Expression.Lambda <Func <Decrementable> >(
                Expression.Decrement(Expression.Constant(operand), method)).Compile(useInterpreter);

            Assert.Equal(expected.Value, func().Value);
        }
Пример #3
0
 public static Decrementable DoublyDecrement(Decrementable operand) => new Decrementable(operand.Value - 2);
 public static Decrementable DoublyDecrement(Decrementable operand) => new Decrementable(unchecked (operand.Value - 2));
Пример #5
0
 public static Decrementable DoublyDecrement(Decrementable operand) => new Decrementable(operand.Value - 2);
Пример #6
0
 public static void UserDefinedOpDecrement(Decrementable? operand, Decrementable? expected, bool useInterpreter)
 {
     MethodInfo method = typeof(IncrementDecrementTests).GetMethod(nameof(DoublyDecrement));
     Func<Decrementable?> func = Expression.Lambda<Func<Decrementable?>>(
         Expression.Decrement(Expression.Constant(operand, typeof(Decrementable?)), method)).Compile(useInterpreter);
     Assert.Equal(expected, func());
 }
Пример #7
0
 public static void CustomOpDecrement(Decrementable? operand, Decrementable? expected, bool useInterpreter)
 {
     Func<Decrementable?> func = Expression.Lambda<Func<Decrementable?>>(
         Expression.Decrement(Expression.Constant(operand, typeof(Decrementable?)))).Compile(useInterpreter);
     Assert.Equal(expected, func());
 }