Beispiel #1
0
        public void Reduce(int size, Type type)
        {
            CallSiteBinder binder = Binder.GetMember(
                CSharpBinderFlags.None, "Member", GetType(),
                new[] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) });
            DynamicExpression exp = Expression.Dynamic(
                binder, type, Enumerable.Range(0, size).Select(_ => Expression.Constant(0)));

            Assert.True(exp.CanReduce);
            InvocationExpression reduced = (InvocationExpression)exp.ReduceAndCheck();

            Assert.Equal(exp.Arguments, reduced.Arguments.Skip(1));
        }