Пример #1
0
        private static void InterceptCallTo(IMethodInterceptor interceptor, Assembly assembly)
        {
            var aType = assembly.GetType("FakeItEasy.A");

            var callToOfTFunc = GetCallToOfT(aType, typeof(Func<>));
            var callToOfTAction = GetCallToOfT(aType, typeof(Action));

            interceptor.InterceptMethod(callToOfTFunc);
            interceptor.InterceptMethod(callToOfTAction);

            Cop.Intercept();
        }
        private static void InterceptCallTo(IMethodInterceptor interceptor, Assembly assembly)
        {
            var aType = assembly.GetType("FakeItEasy.A");

            var unboundExpression = typeof (Expression<>);
            var unboundFunc = typeof (Func<>);
            var boundExprOfFunc = unboundExpression.MakeGenericType(unboundFunc);

            var callToOfT = aType.GetGenericMethod("CallTo", new[] {boundExprOfFunc});

            interceptor.InterceptMethod(callToOfT);

            Cop.Intercept();
        }