Beispiel #1
0
 static List<TestInfo> GetTestInfoList()
 {
     List<TestInfo> testList = new List<TestInfo>();
     Type t = typeof(Test1);
     var mets = t.GetMethods(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
     foreach (var met in mets)
     {
         var found = met.GetCustomAttributes(typeof(TestAttribute), false) as TestAttribute[];
         if (found != null && found.Length > 0)
         {
             TestInfo testInfo = new TestInfo()
             {
                 Choice = found[0].Choice,
                 Name = found[0].Name,
                 TestMethod = met
             };
             testList.Add(testInfo);
         }
     }
     return testList;
 }