Exemplo n.º 1
0
        public static void With(this Func <MethodBase> methodSelector, IMethodCall methodCall)
        {
            var targetMethod = methodSelector();

            Func <MethodBase, bool> selector = method =>
            {
                // Match the methods by declaring type name and signature
                // Note: The CLR doesn't see the two methods as the same type
                // since one of the other types will be modified by the Deflector library
                var result = method?.DeclaringType?.FullName == targetMethod?.DeclaringType?.FullName &&
                             method.HasCompatibleMethodSignatureWith(targetMethod);

                return(result);
            };

            var binder = new MethodCallBinder(selector, methodCall);

            MethodCallBinderRegistry.AddBinder(binder);
        }
Exemplo n.º 2
0
        public static void With(this Func <MethodBase, bool> methodSelector, IMethodCall methodCall)
        {
            var binder = new MethodCallBinder(methodSelector, methodCall);

            MethodCallBinderRegistry.AddBinder(binder);
        }