コード例 #1
0
ファイル: FakeItEasy.cs プロジェクト: hmemcpy/Sledgehammer
        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();
        }
コード例 #2
0
        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();
        }