public void Test_SplitThreads()
        {
            string applicationName = "MockApplication";

            string testLogDir = TestUtilities.GetTestDataPath(this, applicationName);


            string dateStamp = DateTime.Now.ToShortDateString().Replace("/", "-");

            LogThreader threader = new LogThreader(testLogDir, dateStamp);

            string testThreadsDirectoryPath = threader.ThreadsDirectoryPath;

            // Create a test log file
            string testLogFile   = threader.LogFilePath;
            string testIndexFile = testLogDir + Path.DirectorySeparatorChar + dateStamp + Path.DirectorySeparatorChar + threader.ThreadsDirectoryName + Path.DirectorySeparatorChar + threader.ThreadsIndexFileName;

            if (!Directory.Exists(testThreadsDirectoryPath))
            {
                Directory.CreateDirectory(testThreadsDirectoryPath);
            }


            if (!Directory.Exists(Path.GetDirectoryName(testLogFile)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(testLogFile));
            }

            // Ensure the old files are cleared
            // TODO: Remove: This should no longer be necessary
            foreach (string file in Directory.GetFiles(testThreadsDirectoryPath))
            {
                File.Delete(file);
            }

            using (StreamWriter writer = new StreamWriter(File.Create(testLogFile)))
            {
                writer.Write(CreateExampleLog());

                writer.Close();
            }

            // Analyze the test log file
            threader.SplitThreads();



            // Check that the index file was created
            Assert.AreEqual(true, File.Exists(testIndexFile), "The index file wasn't found.");

            XmlDocument indexDoc = new XmlDocument();

            indexDoc.Load(testIndexFile);

            foreach (XmlNode node in indexDoc.DocumentElement.ChildNodes)
            {
                Assert.IsTrue(node.Attributes["ID"] != null, "The ID attribute of the thread node is null.");

                Guid id = new Guid(node.Attributes["ID"].Value);
                Assert.AreNotEqual(Guid.Empty, id, "The thread ID is Guid.Empty.");


                //Assert.IsTrue(node.Attributes["Title"] != null, "The title attribute of the thread node is null.");

                //string title = node.Attributes["Title"].Value;
                //Assert.AreNotEqual(String.Empty, title, "The thread title is String.Empty.");
            }



            /*string[] fileNames = Directory.GetFiles(testLogDir + @"\Detail");
             *
             * // Now read the creation time for each file
             * DateTime[] creationTimes = new DateTime[fileNames.Length];
             * for (int i=0; i < fileNames.Length; i++)
             *      creationTimes[i] = new FileInfo(fileNames[i]).CreationTime;
             *
             * // sort it
             * Array.Sort(creationTimes,fileNames);
             *
             * Assert.AreEqual(5, fileNames.Length, "Incorrect number of thread files created.");
             *
             * string fileName0 = Path.GetFileName(fileNames[0]);
             * string fileName1 = Path.GetFileName(fileNames[1]);
             * string fileName2 = Path.GetFileName(fileNames[2]);
             * string fileName3 = Path.GetFileName(fileNames[3]);
             *
             * Assert.AreEqual("ASP.global_asax.Application_Start.xml", fileName0, "The sub log file in position 0 has an invalid name.");
             * Assert.AreEqual("SoftwareMonkeys.SiteStarter.Configuration.Config.Initialize.xml", fileName1, "The sub log file in position 1 has an invalid name.");
             * Assert.AreEqual("ASP.global_asax.Application_Start.xml", fileName2, "The sub log file in position 2 has an invalid name.");
             * Assert.AreEqual("ASP.global_asax.Application_Start.xml", fileName3, "The sub log file in position 3 has an invalid name.");*/
        }
		public void Test_SplitThreads()
		{
			string applicationName = "MockApplication";
			
			string testLogDir = TestUtilities.GetTestDataPath(this, applicationName);

			
			string dateStamp = DateTime.Now.ToShortDateString().Replace("/", "-");
			
			LogThreader threader = new LogThreader(testLogDir, dateStamp);

			string testThreadsDirectoryPath = threader.ThreadsDirectoryPath;
			
			// Create a test log file
			string testLogFile = threader.LogFilePath;
			string testIndexFile = testLogDir + Path.DirectorySeparatorChar + dateStamp + Path.DirectorySeparatorChar + threader.ThreadsDirectoryName + Path.DirectorySeparatorChar + threader.ThreadsIndexFileName;
			
			if (!Directory.Exists(testThreadsDirectoryPath))
				Directory.CreateDirectory(testThreadsDirectoryPath);
			
			
			if (!Directory.Exists(Path.GetDirectoryName(testLogFile)))
				Directory.CreateDirectory(Path.GetDirectoryName(testLogFile));
			
			// Ensure the old files are cleared
			// TODO: Remove: This should no longer be necessary
			foreach (string file in Directory.GetFiles(testThreadsDirectoryPath))
				File.Delete(file);
			
			using (StreamWriter writer = new StreamWriter(File.Create(testLogFile)))
			{
				writer.Write(CreateExampleLog());
				
				writer.Close();
			}
			
			// Analyze the test log file
			threader.SplitThreads();
			
			
			
			// Check that the index file was created
			Assert.AreEqual(true, File.Exists(testIndexFile), "The index file wasn't found.");
			
			XmlDocument indexDoc = new XmlDocument();
			indexDoc.Load(testIndexFile);
			
			foreach (XmlNode node in indexDoc.DocumentElement.ChildNodes)
			{
				Assert.IsTrue(node.Attributes["ID"] != null, "The ID attribute of the thread node is null.");
				
				Guid id = new Guid(node.Attributes["ID"].Value);
				Assert.AreNotEqual(Guid.Empty, id, "The thread ID is Guid.Empty.");
				
				
				//Assert.IsTrue(node.Attributes["Title"] != null, "The title attribute of the thread node is null.");
				
				//string title = node.Attributes["Title"].Value;
				//Assert.AreNotEqual(String.Empty, title, "The thread title is String.Empty.");
				
				
			}
			
			
			
			
			/*string[] fileNames = Directory.GetFiles(testLogDir + @"\Detail");
			
			// Now read the creation time for each file
			DateTime[] creationTimes = new DateTime[fileNames.Length];
			for (int i=0; i < fileNames.Length; i++)
				creationTimes[i] = new FileInfo(fileNames[i]).CreationTime;
			
			// sort it
			Array.Sort(creationTimes,fileNames);
			
			Assert.AreEqual(5, fileNames.Length, "Incorrect number of thread files created.");
			
			string fileName0 = Path.GetFileName(fileNames[0]);
			string fileName1 = Path.GetFileName(fileNames[1]);
			string fileName2 = Path.GetFileName(fileNames[2]);
			string fileName3 = Path.GetFileName(fileNames[3]);
			
			Assert.AreEqual("ASP.global_asax.Application_Start.xml", fileName0, "The sub log file in position 0 has an invalid name.");
			Assert.AreEqual("SoftwareMonkeys.SiteStarter.Configuration.Config.Initialize.xml", fileName1, "The sub log file in position 1 has an invalid name.");
			Assert.AreEqual("ASP.global_asax.Application_Start.xml", fileName2, "The sub log file in position 2 has an invalid name.");
			Assert.AreEqual("ASP.global_asax.Application_Start.xml", fileName3, "The sub log file in position 3 has an invalid name.");*/
			
		}