/// <summary>Tests the Test Drivers specified by the calling thread</summary>
 /// <param name="xReader">Reference to the XMLReader involved</param>
 /// <param name="Log">Reference to the log to append</param>
 /// <param name="innerLog">Reference to the inner log. This helps orginizing the results file</param>
 void TestFiles(ref XMLReader xReader, ref StringBuilder Log, ref StringBuilder innerLog, string Name)
 {
     Log.Append("\n\nResults:");
     foreach (var Test in xReader.TestDrivers)
     {
         Log.Append("\n\t" + Test.Key + ":");
         innerLog.Append("\n" + Test.Key + ":\n\n");
         foreach (string TestDriver in Test.Value)
         {
             // load the file in a child AppDomain. This is useful as we need to unload the
             // assembly and that cannot be done if it was loaded directly
             AppDomain ChildDomain = AppDomain.CreateDomain(Name + "ChildDomain");
             ChildDomain.Load("TestAppDomain");
             ObjectHandle  objH   = ChildDomain.CreateInstance("TestAppDomain", "RemoteTestHarness.TestAppDomain");
             TestAppDomain Tester = (TestAppDomain)objH.Unwrap();
             Tester.path = Path.Combine(".\\" + Name, TestDriver);
             // perform testing
             Tester.execute();
             Log.Append("\n\t\t" + Tester.getLog());
             innerLog.Append(Tester.getLog(true) + "\n");
             // unload the assembly to set the assembly file free
             AppDomain.Unload(ChildDomain);
         }
     }
 }
        /* --------------------< End of Processing & Testing Assemblies Region >------------------ */


        /* -------------------< TEST STUB >------------------- */
#if (TEST_APPDOMAIN)
        static void Main(string[] args)
        {
            string path = @".\TestHarnessTestLibrary.dll";

            if (File.Exists(path))
            {
                TestAppDomain Tester = new TestAppDomain(path);
                Tester.execute();
                Console.Write("\n Using test() to get result: {0}", Tester.test());
                Console.Write("\n Using getLog() to get short summary:\n  {0}", Tester.getLog());
                Console.Write("\n\n Using getLog(true) to get detailed summary:\n{0}", Tester.getLog(true));
            }
        }