本文整理汇总了C#中IMethodInfo.IsDefined方法的典型用法代码示例。如果您正苦于以下问题:C# IMethodInfo.IsDefined方法的具体用法?C# IMethodInfo.IsDefined怎么用?C# IMethodInfo.IsDefined使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMethodInfo
的用法示例。
在下文中一共展示了IMethodInfo.IsDefined方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParameterizedMethodSuite
/// <summary>
/// Construct from a MethodInfo
/// </summary>
/// <param name="method"></param>
public ParameterizedMethodSuite(IMethodInfo method)
: base(method.TypeInfo.FullName, method.Name)
{
Method = method;
#if PORTABLE
_isTheory = false;
#else
_isTheory = method.IsDefined<TheoryAttribute>(true);
#endif
this.MaintainTestOrder = true;
}
示例2: CanBuildFrom
/// <summary>
/// Determines if the method can be used to build an NUnit test
/// test method of some kind. The method must normally be marked
/// with an identifying attribute for this to be true.
///
/// Note that this method does not check that the signature
/// of the method for validity. If we did that here, any
/// test methods with invalid signatures would be passed
/// over in silence in the test run. Since we want such
/// methods to be reported, the check for validity is made
/// in BuildFrom rather than here.
/// </summary>
/// <param name="method">An IMethodInfo for the method being used as a test method</param>
/// <returns>True if the builder can create a test case from this method</returns>
public bool CanBuildFrom(IMethodInfo method)
{
return method.IsDefined<ITestBuilder>(false)
|| method.IsDefined<ISimpleTestBuilder>(false);
}