示例#1
0
 public void AddMethodCalls(object target, MethodBase hostMethod, IEnumerable <MethodBase> interceptedMethods,
                            IMethodCallMap methodCallMap,
                            StackTrace stackTrace)
 {
     foreach (var provider in _methodCallProviders)
     {
         provider.AddMethodCalls(target, hostMethod, interceptedMethods, methodCallMap, stackTrace);
     }
 }
        public void AddMethodCalls(object target, MethodBase hostMethod, IEnumerable <MethodBase> interceptedMethods,
                                   IMethodCallMap methodCallMap,
                                   StackTrace stackTrace)
        {
            // Map the implementation to the most compatible method signature
            var bestMatch = interceptedMethods.GetBestMatch(_targetMethod);

            if (bestMatch == null)
            {
                return;
            }

            // Verify the delegate signature
            if (!bestMatch.HasCompatibleMethodSignatureWith(_implementation.Method))
            {
                return;
            }

            methodCallMap.Add(method => method == bestMatch, new DelegateMethodCall(_implementation));
        }
示例#3
0
        public void AddMethodCalls(object target, MethodBase hostMethod, IEnumerable <MethodBase> interceptedMethods, IMethodCallMap methodCallMap,
                                   StackTrace stackTrace)
        {
            var targetMethods = interceptedMethods.Where(method => _methodFilter(method)).ToArray();

            foreach (var method in targetMethods)
            {
                methodCallMap.Add(_methodFilter, _methodCall);
            }
        }
示例#4
0
 public static void Store(MethodBase method, IMethodCallMap map)
 {
     _entries[method] = map;
 }
 public static void Store(IMethodCallMap map)
 {
     _entries.Add(map);
 }