当前位置: 首页>>代码示例>>C#>>正文


C# ICall.GetMethodInfo方法代码示例

本文整理汇总了C#中ICall.GetMethodInfo方法的典型用法代码示例。如果您正苦于以下问题:C# ICall.GetMethodInfo方法的具体用法?C# ICall.GetMethodInfo怎么用?C# ICall.GetMethodInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICall的用法示例。


在下文中一共展示了ICall.GetMethodInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FormatCall

        private string FormatCall(ICall call, bool isAcrossMultipleTargets, TypeInstanceNumberLookup instanceLookup)
        {
            var s = _callFormatter.Format(call.GetMethodInfo(), FormatArgs(call.GetArguments()));
            if (!isAcrossMultipleTargets) return s;

            var target = call.Target();
            var methodInfo = call.GetMethodInfo();
            return FormatCallForInstance(instanceLookup, target, methodInfo, s);
        }
开发者ID:robdmoore,项目名称:NSubstitute,代码行数:9,代码来源:SequenceInOrderAssertion.cs

示例2: IsSatisfiedBy

 public bool IsSatisfiedBy(ICall call)
 {
     if (_methodInfo != call.GetMethodInfo()) return false;
     if (HasDifferentNumberOfArguments(call)) return false;
     if (NonMatchingArguments(call).Any()) return false;
     return true;
 }
开发者ID:tanujmathur,项目名称:NSubstitute,代码行数:7,代码来源:CallSpecification.cs

示例3: Handle

        public RouteAction Handle(ICall call)
        {
            // We want the proxies to respond to the base object methods (e.g. Equals, GetHashCode)
            if (call.GetMethodInfo().GetBaseDefinition().DeclaringType == typeof(object))
                return RouteAction.Return(call.CallOriginalMethod());

            return RouteAction.Continue();
        }
开发者ID:robdmoore,项目名称:NSubstitute,代码行数:8,代码来源:ReturnOriginalResultCallHandler.cs

示例4: CreateFrom

 public ICallSpecification CreateFrom(ICall call, MatchArgs matchArgs)
 {
     var methodInfo = call.GetMethodInfo();
     var argumentSpecs = call.GetArgumentSpecifications();
     var arguments = call.GetOriginalArguments();
     var parameterInfos = call.GetParameterInfos();
     var argumentSpecificationsForCall = _argumentSpecificationsFactory.Create(argumentSpecs, arguments, parameterInfos, matchArgs);
     return new CallSpecification(methodInfo, argumentSpecificationsForCall);
 }
开发者ID:nsubstitute,项目名称:NSubstitute,代码行数:9,代码来源:CallSpecificationFactory.cs

示例5: CreateCallToPropertyGetterFromSetterCall

 public ICall CreateCallToPropertyGetterFromSetterCall(ICall callToSetter)
 {
     var propertyInfo = GetPropertyFromSetterCallOrNull(callToSetter);
     if (!PropertySetterExistsAndHasAGetMethod(propertyInfo))
     {
         throw new InvalidOperationException("Could not find a GetMethod for \"" + callToSetter.GetMethodInfo() + "\"");
     }
     var getter = propertyInfo.GetGetMethod();
     return new CallToPropertyGetter(getter, callToSetter.Target());
 }
开发者ID:troyhunt,项目名称:NSubstitute,代码行数:10,代码来源:PropertyHelper.cs

示例6: CreateCallToPropertyGetterFromSetterCall

 public ICall CreateCallToPropertyGetterFromSetterCall(ICall callToSetter)
 {
     var propertyInfo = GetPropertyFromSetterCallOrNull(callToSetter);
     if (!PropertySetterExistsAndHasAGetMethod(propertyInfo))
     {
         throw new InvalidOperationException("Could not find a GetMethod for \"" + callToSetter.GetMethodInfo() + "\"");
     }
     var setterArgs = callToSetter.GetArguments();
     var getter = propertyInfo.GetGetMethod();
     var getterArgs = setterArgs.Take(setterArgs.Length - 1).ToArray();
     return new Call(getter, getterArgs, callToSetter.Target(), callToSetter.GetArgumentSpecifications());
 }
开发者ID:deatharthas,项目名称:NSubstitute,代码行数:12,代码来源:PropertyHelper.cs

示例7: IsSatisfiedBy

 public bool IsSatisfiedBy(ICall call)
 {
     if (MethodInfo != call.GetMethodInfo()) return false;
     var arguments = call.GetArguments();
     if (arguments.Length != ArgumentSpecifications.Count) return false;
     for (int i = 0; i < arguments.Length; i++)
     {
         var argumentMatchesSpecification = ArgumentSpecifications[i].IsSatisfiedBy(arguments[i]);
         if (!argumentMatchesSpecification) return false;
     }
     return true;
 }
开发者ID:troyhunt,项目名称:NSubstitute,代码行数:12,代码来源:CallSpecification.cs

示例8: Handle

 public object Handle(ICall call)
 {
     var methodInfo = call.GetMethodInfo();
     var eventInfo = methodInfo.DeclaringType.GetEvents().First(
         x => (x.GetAddMethod() == methodInfo) || (x.GetRemoveMethod() == methodInfo));
     var handlers = _eventHandlerRegistry.GetHandlers(eventInfo.Name);
     var eventArguments = _getEventArguments(call);
     foreach (Delegate handler in handlers)
     {
         handler.DynamicInvoke(eventArguments);
     }
     return null;
 }
开发者ID:troyhunt,项目名称:NSubstitute,代码行数:13,代码来源:RaiseEventHandler.cs

示例9: CreateFrom

 public ICallSpecification CreateFrom(ICall call)
 {
     var result = new CallSpecification(call.GetMethodInfo());
     var argumentSpecs = _context.DequeueAllArgumentSpecifications();
     var arguments = call.GetArguments();
     if (argumentSpecs.Count == 0)
     {
         AddArgumentSpecsToCallSpec(result, arguments.Select(x => (IArgumentSpecification) new ArgumentEqualsSpecification(x)));
     }
     else if (argumentSpecs.Count == arguments.Length)
     {
         AddArgumentSpecsToCallSpec(result, argumentSpecs);
     }
     else
     {
         throw new AmbiguousArgumentsException(
             "Cannot determine argument specifications to use. Please use specifications for all arguments.");
     }
     return result;
 }
开发者ID:troyhunt,项目名称:NSubstitute,代码行数:20,代码来源:CallSpecificationFactory.cs

示例10: Handle

        public RouteAction Handle(ICall call)
        {
            var methodInfo = call.GetMethodInfo();
            var eventInfo = methodInfo.DeclaringType.GetEvents().First(
                x => (x.GetAddMethod() == methodInfo) || (x.GetRemoveMethod() == methodInfo));
            var handlers = _eventHandlerRegistry.GetHandlers(eventInfo.Name);
            var eventArguments = _getEventArguments(call);
            foreach (Delegate handler in handlers)
            {
                try
                {
                    handler.DynamicInvoke(eventArguments);
                }
                catch (TargetInvocationException e)
                {
                    PreserveStackTrace(e.InnerException);

                    throw e.InnerException;
                }
            }
            return RouteAction.Continue();
        }
开发者ID:BergeAadland,项目名称:NSubstitute,代码行数:22,代码来源:RaiseEventHandler.cs

示例11: GetEvents

 private IEnumerable<EventInfo> GetEvents(ICall call, Func<ICall, Predicate<EventInfo>> createPredicate)
 {
     var predicate = createPredicate(call);
     return call.GetMethodInfo().DeclaringType.GetEvents().Where(x => predicate(x));
 }
开发者ID:deatharthas,项目名称:NSubstitute,代码行数:5,代码来源:EventSubscriptionHandler.cs

示例12: Format

 public string Format(ICall call)
 {
     return CallFormatter.Format(call.GetMethodInfo(), FormatArguments(call.GetArguments()));
 }
开发者ID:deatharthas,项目名称:NSubstitute,代码行数:4,代码来源:CallSpecification.cs

示例13: IsEventUnsubscription

 private Predicate<EventInfo> IsEventUnsubscription(ICall call)
 {
     return x => call.GetMethodInfo() == x.GetRemoveMethod();
 }
开发者ID:deatharthas,项目名称:NSubstitute,代码行数:4,代码来源:EventSubscriptionHandler.cs

示例14: IsEventSubscription

 private Predicate<EventInfo> IsEventSubscription(ICall call)
 {
     return x => call.GetMethodInfo() == x.GetAddMethod();
 }
开发者ID:deatharthas,项目名称:NSubstitute,代码行数:4,代码来源:EventSubscriptionHandler.cs

示例15: GetPropertyFromSetterCallOrNull

 private PropertyInfo GetPropertyFromSetterCallOrNull(ICall call)
 {
     return call.GetMethodInfo().GetPropertyFromSetterCallOrNull();
 }
开发者ID:deatharthas,项目名称:NSubstitute,代码行数:4,代码来源:PropertyHelper.cs


注:本文中的ICall.GetMethodInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。