本文整理汇总了C#中IInterceptedFakeObjectCall.SetArgumentValue方法的典型用法代码示例。如果您正苦于以下问题:C# IInterceptedFakeObjectCall.SetArgumentValue方法的具体用法?C# IInterceptedFakeObjectCall.SetArgumentValue怎么用?C# IInterceptedFakeObjectCall.SetArgumentValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IInterceptedFakeObjectCall
的用法示例。
在下文中一共展示了IInterceptedFakeObjectCall.SetArgumentValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyOutputArguments
private static void ApplyOutputArguments(IInterceptedFakeObjectCall call, CallDataMetadata callToApply)
{
foreach (var outputArgument in call.Method.GetParameters()
.Select((parameter, index) => new { Parameter = parameter, Index = index })
.Where(argument => argument.Parameter.ParameterType.IsByRef)
.Select(argument => argument.Index).Zip(callToApply.RecordedCall.OutputArguments, (index, outputArgument) => new { Index = index, Value = outputArgument }))
{
call.SetArgumentValue(outputArgument.Index, outputArgument.Value);
}
}
示例2: ApplyOutAndRefParametersValues
private void ApplyOutAndRefParametersValues(IInterceptedFakeObjectCall fakeObjectCall)
{
if (this.OutAndRefParametersValues == null)
{
return;
}
var indexes = GetIndexesOfOutAndRefParameters(fakeObjectCall);
if (this.OutAndRefParametersValues.Count != indexes.Count)
{
throw new InvalidOperationException(ExceptionMessages.NumberOfOutAndRefParametersDoesNotMatchCall);
}
foreach (var argument in indexes.Zip(this.OutAndRefParametersValues))
{
fakeObjectCall.SetArgumentValue(argument.Item1, argument.Item2);
}
}
示例3: ApplyOutputArguments
private static void ApplyOutputArguments(IInterceptedFakeObjectCall call, CallDataMetadata callToApply)
{
foreach (var outputArgument in GetIndicesAndValuesOfOutputParameters(call, callToApply.RecordedCall))
{
call.SetArgumentValue(outputArgument.Item1, outputArgument.Item2);
}
}
示例4: ApplyOutAndRefParametersValueProducer
private void ApplyOutAndRefParametersValueProducer(IInterceptedFakeObjectCall fakeObjectCall)
{
if (this.OutAndRefParametersValueProducer == null)
{
return;
}
var indexes = GetIndexesOfOutAndRefParameters(fakeObjectCall);
var values = this.OutAndRefParametersValueProducer(fakeObjectCall);
if (values.Count != indexes.Count)
{
throw new InvalidOperationException(ExceptionMessages.NumberOfOutAndRefParametersDoesNotMatchCall);
}
foreach (var argument in indexes.Zip(values, (index, value) => new { Index = index, Value = value }))
{
fakeObjectCall.SetArgumentValue(argument.Index, argument.Value);
}
}
示例5: ApplyOutAndRefParametersValues
private void ApplyOutAndRefParametersValues(IInterceptedFakeObjectCall fakeObjectCall)
{
if (this.OutAndRefParametersValues == null)
{
return;
}
var indexes = GetIndexesOfOutAndRefParameters(fakeObjectCall);
if (this.OutAndRefParametersValues.Count != indexes.Count)
{
throw new InvalidOperationException(ExceptionMessages.NumberOfOutAndRefParametersDoesNotMatchCall);
}
foreach (var argument in indexes.Zip(this.OutAndRefParametersValues))
{
if (this.DoEvaluateOutAndRefFuncs)
{
Func<object> getter = argument.Item2 as Func<object>;
if (getter != null)
{
object value = getter();
fakeObjectCall.SetArgumentValue(argument.Item1, value);
}
}
else
{
fakeObjectCall.SetArgumentValue(argument.Item1, argument.Item2);
}
}
}