本文整理汇总了C#中IMethodInfo.Resolve方法的典型用法代码示例。如果您正苦于以下问题:C# IMethodInfo.Resolve方法的具体用法?C# IMethodInfo.Resolve怎么用?C# IMethodInfo.Resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMethodInfo
的用法示例。
在下文中一共展示了IMethodInfo.Resolve方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecorateContainingScope
/// <inheritdoc />
protected override void DecorateContainingScope(IPatternScope containingScope, IMethodInfo methodInfo)
{
Type formattableType = methodInfo.Parameters[0].Resolve(true).ParameterType;
var extensionPoints = (IExtensionPoints)RuntimeAccessor.ServiceLocator.ResolveByComponentId("Gallio.ExtensionPoints");
CustomTestEnvironment.SetUpThreadChain.Before(() => extensionPoints.CustomFormatters.Register(formattableType, x => (string)methodInfo.Resolve(true).Invoke(this, new[] { x })));
CustomTestEnvironment.TeardownThreadChain.After(() => extensionPoints.CustomFormatters.Unregister(formattableType));
}
示例2: ResolveMethod
public static MethodInfo ResolveMethod(IMethodInfo method, bool nonPublic)
{
return method != null && (nonPublic || method.IsPublic) ? method.Resolve(false) : null;
}
示例3: DecorateContainingScope
/// <inheritdoc />
protected override void DecorateContainingScope(IPatternScope containingScope, IMethodInfo methodInfo)
{
Type comparableType = methodInfo.Parameters[0].Resolve(true).ParameterType;
CustomTestEnvironment.SetUpThreadChain.Before(() => Register(comparableType, (x, y) => methodInfo.Resolve(true).Invoke(this, new[] { x, y })));
CustomTestEnvironment.TeardownThreadChain.After(() => Unregister(comparableType));
}
示例4: DecorateContainingScope
/// <inheritdoc />
protected override void DecorateContainingScope(IPatternScope containingScope, IMethodInfo method)
{
MethodInfo factoryMethod = method.Resolve(false);
if (factoryMethod == null || Reflector.IsUnresolved(factoryMethod))
{
containingScope.TestModelBuilder.AddAnnotation(new Annotation(AnnotationType.Info, method,
"This test runner does not fully support static test factory methods "
+ "because the code that defines the factory cannot be executed "
+ "at test exploration time. Consider using dynamic test factory "
+ "methods instead."));
return;
}
var tests = factoryMethod.Invoke(null, null) as IEnumerable<Test>;
if (tests == null)
{
containingScope.TestModelBuilder.AddAnnotation(new Annotation(AnnotationType.Error, method,
"Expected the static test factory method to return a value that is assignable "
+ "to type IEnumerable<Test>."));
return;
}
Test.BuildStaticTests(tests, containingScope, method);
}