本文整理汇总了C#中Classes.WithoutAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# Classes.WithoutAttribute方法的具体用法?C# Classes.WithoutAttribute怎么用?C# Classes.WithoutAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Classes
的用法示例。
在下文中一共展示了Classes.WithoutAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AllMethodsVirtual
public static void AllMethodsVirtual(Assembly assembly, Predicate<Class> predicate)
{
var classes = new Classes(assembly);
List<Class> nonTestClasses = classes.WithoutAttribute(typeof(TestFixtureAttribute)).FindAll(obj => !obj.Name.Contains("Test"));
var filteredClasses = new Classes(nonTestClasses.FindAll(predicate));
MethodInfos nonVirtuals = filteredClasses.NonVirtuals;
BricksCollection<MethodInfo> oughtToBeVirtual = nonVirtuals.Filter(delegate(MethodInfo obj) { return !obj.Name.Contains("NonVirtual"); });
Assert.AreEqual(0, oughtToBeVirtual.Count, oughtToBeVirtual.ToString());
}
示例2: AssertAllMethodsAreVirtual
public static void AssertAllMethodsAreVirtual(Assembly assembly)
{
var classes = new Classes(assembly);
Classes nonTestClasses = classes.WithoutAttribute(typeof(TestFixtureAttribute));
nonTestClasses = nonTestClasses.Filter(@class => [email protected]("Test"));
MethodInfos nonVirtuals = nonTestClasses.NonVirtuals;
BricksCollection<MethodInfo> oughtToBeVirtual = nonVirtuals.Filter(obj => !obj.Name.Contains("NonVirtual"));
nonVirtuals.ForEach(entity => Console.WriteLine(entity.DeclaringType.FullName + "." + entity.Name));
Assert.AreEqual(0, oughtToBeVirtual.Count);
}