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


C# ICall.GetArguments方法代码示例

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


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

示例1: NonMatchingArguments

 public IEnumerable<ArgumentMatchInfo> NonMatchingArguments(ICall call)
 {
     var arguments = call.GetArguments();
     return arguments
             .Select((arg, index) => new ArgumentMatchInfo(index, arg, _argumentSpecifications[index]))
             .Where(x => !x.IsMatch);
 }
开发者ID:tanujmathur,项目名称:NSubstitute,代码行数:7,代码来源:CallSpecification.cs

示例2: If

 private void If(ICall call, Func<ICall, Predicate<EventInfo>> meetsThisSpecification, Action<string, object> takeThisAction)
 {
     var events = GetEvents(call, meetsThisSpecification);
     if (events.Any())
     {
         takeThisAction(events.First().Name, call.GetArguments()[0]);
     }            
 }
开发者ID:deatharthas,项目名称:NSubstitute,代码行数:8,代码来源:EventSubscriptionHandler.cs

示例3: CreateFrom

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

示例4: 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

示例5: NonMatchingArgumentIndicies

 public IEnumerable<int> NonMatchingArgumentIndicies(ICall call)
 {
     var arguments = call.GetArguments();
     for (var i = 0; i < arguments.Length; i++)
     {
         var argumentMatchesSpecification = ArgIsSpecifiedAndMatchesSpec(arguments[i], i);
         if (!argumentMatchesSpecification) yield return i;
     }
 }
开发者ID:kkozmic,项目名称:NSubstitute,代码行数:9,代码来源:CallSpecification.cs

示例6: Handle

 public RouteAction Handle(ICall call)
 {
     if (_propertyHelper.IsCallToSetAReadWriteProperty(call))
     {
         var callToPropertyGetter = _propertyHelper.CreateCallToPropertyGetterFromSetterCall(call);
         var valueBeingSetOnProperty = call.GetArguments().First();
         _resultSetter.SetResultForCall(callToPropertyGetter, new ReturnValue(valueBeingSetOnProperty), MatchArgs.AsSpecifiedInCall);
     }
     return RouteAction.Continue();
 }
开发者ID:rodrigoelp,项目名称:NSubstitute,代码行数:10,代码来源:PropertySetterHandler.cs

示例7: Handle

 public object Handle(ICall call)
 {
     if (_propertyHelper.IsCallToSetAReadWriteProperty(call))
     {
         var callToPropertyGetter = _propertyHelper.CreateCallToPropertyGetterFromSetterCall(call);
         var valueBeingSetOnProperty = call.GetArguments().First();
         _resultSetter.SetResultForCall(callToPropertyGetter, valueBeingSetOnProperty);
     }
     return null;
 }
开发者ID:troyhunt,项目名称:NSubstitute,代码行数:10,代码来源:PropertySetterHandler.cs

示例8: GetArgumentsFromCall

        private static IEnumerable<Argument> GetArgumentsFromCall(ICall call)
        {
            var values = call.GetArguments();
            var types = call.GetParameterInfos().Select(x => x.ParameterType).ToArray();

            for (var index = 0; index < values.Length; index++)
            {
                var i = index;
                yield return new Argument(types[i], () => values[i], x => values[i] = x);
            }
        }
开发者ID:BergeAadland,项目名称:NSubstitute,代码行数:11,代码来源:CallInfoFactory.cs

示例9: 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

示例10: 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

示例11: 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

示例12: Handle

 public object Handle(ICall call)
 {
     _actionToPerform(call.GetArguments());
     return null;
 }
开发者ID:troyhunt,项目名称:NSubstitute,代码行数:5,代码来源:DoOnCallHandler.cs

示例13: HasDifferentNumberOfArguments

 private bool HasDifferentNumberOfArguments(ICall call)
 {
     return _argumentSpecifications.Length != call.GetArguments().Length;
 }
开发者ID:tanujmathur,项目名称:NSubstitute,代码行数:4,代码来源:CallSpecification.cs

示例14: Format

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

示例15: Format

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


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