Example #1
0
 public static void InvokeMethods()
 {
     try
     {
         foreach (Object library in lstTestLibaries)
         {
             var methods = library.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance)
                           .Where(
                 item => item.GetCustomAttributes(typeof(TestCase), false).Length > 0
                 );
             foreach (var item in methods)
             {
                 clsTestCase t = ObjectHelper.ConvertAttributeToObject(item);
                 if (!t.TestIgnore)
                 {
                     item.Invoke(library, new Object[0]);
                 }
             }
         }
     }
     catch (Exception e)
     {
         //to do
     }
 }
Example #2
0
 public static clsTestCase ConvertAttributeToObject(Object inObject)
 {
     try
     {
         clsTestCase clsTest    = new clsTestCase();
         MethodInfo  t          = (MethodInfo)inObject;
         object[]    attributes = t.GetCustomAttributes(true);
         foreach (object item in attributes)
         {
             TestCase tc = item as TestCase;
             clsTest = new clsTestCase();
             if (tc != null)
             {
                 clsTest.TestDescription = tc.Description;
                 clsTest.TestIgnore      = tc.Ignore;
             }
         }
         return(clsTest);
     }
     catch (Exception)
     {
         return(null);
     }
 }