本文整理汇总了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);
}
示例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]);
}
}
示例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);
}
示例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);
}
示例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;
}
}
示例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();
}
示例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;
}
示例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);
}
}
示例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());
}
示例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;
}
示例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;
}
示例12: Handle
public object Handle(ICall call)
{
_actionToPerform(call.GetArguments());
return null;
}
示例13: HasDifferentNumberOfArguments
private bool HasDifferentNumberOfArguments(ICall call)
{
return _argumentSpecifications.Length != call.GetArguments().Length;
}
示例14: Format
public string Format(ICall call, ICallSpecification withRespectToCallSpec)
{
return Format(call.GetMethodInfo(), call.GetArguments(), withRespectToCallSpec.NonMatchingArgumentIndicies(call));
}
示例15: Format
private string Format(ICall call)
{
return _callFormatter.Format(call.GetMethodInfo(), FormatArgs(call.GetArguments()));
}