Пример #1
0
 private static void RunTests()
 {
     var tester = new Tests();
     foreach (var method in typeof(Tests).GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
     {
         Console.Write("Running " + method.Name);
         method.Invoke(tester, null);
         Console.WriteLine(" - OK!");
     }
 }
Пример #2
0
 private static void RunTests()
 {
     var tester = new Tests();
     foreach (var method in typeof(Tests).GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
     {
         Console.Write("Running " + method.Name);
         try
         {
             method.Invoke(tester, null);
             Console.WriteLine(" - OK!");
         } catch(TargetInvocationException ex)
         {
             var inner = ex.InnerException;
             if(inner is AggregateException && ((AggregateException)inner).InnerExceptions.Count == 1)
             {
                 inner = ((AggregateException)inner).InnerExceptions.Single();
             }
             Console.WriteLine(" - ERR: " + inner.Message);
         }
     }
 }