Exemplo n.º 1
0
 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());
 }
Exemplo n.º 2
0
 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);
 }