Ejemplo n.º 1
0
        public void Test_AddThreadToIndex()
        {
            //string testLogFile = ApplicationPath + @"\App_Data\Testing\Log.xml";
            //string testIndexFile = ApplicationPath + @"\App_Data\Testing\Detail\Index.xml";
            string rootDir = Path.Combine(ApplicationPath, @"App_Data\Testing");

            Guid   threadID = Guid.NewGuid();
            string title    = "Test Title";
            //string threadTitle = "Test Thread";

            XmlDocument indexDoc = new XmlDocument();

            indexDoc.AppendChild(indexDoc.CreateElement("Index"));

            LogThreader threader = new LogThreader(rootDir, DateTime.Now.ToShortDateString());

            threader.AddThreadToIndex(indexDoc, threadID, title);

            Assert.AreEqual(1, indexDoc.DocumentElement.ChildNodes.Count, "Invalid number of threads found.");

            XmlNode node = indexDoc.DocumentElement.ChildNodes[0];

            Assert.AreEqual(threadID.ToString(), node.Attributes["ID"].Value, "The thread doesn't have the expected ID.");
            Assert.AreEqual(title, node.Attributes["Title"].Value, "The thread doesn't have the expected title.");
        }
Ejemplo n.º 2
0
		public void Test_AddThreadToIndex()
		{
			
			//string testLogFile = ApplicationPath + @"\App_Data\Testing\Log.xml";
			//string testIndexFile = ApplicationPath + @"\App_Data\Testing\Detail\Index.xml";
			string rootDir = Path.Combine(ApplicationPath, @"App_Data\Testing");
			
			Guid threadID = Guid.NewGuid();
			string title = "Test Title";
			//string threadTitle = "Test Thread";
			
			XmlDocument indexDoc = new XmlDocument();
			indexDoc.AppendChild(indexDoc.CreateElement("Index"));
			
			LogThreader threader = new LogThreader(rootDir, DateTime.Now.ToShortDateString());
			
			threader.AddThreadToIndex(indexDoc, threadID, title);
			
			Assert.AreEqual(1, indexDoc.DocumentElement.ChildNodes.Count, "Invalid number of threads found.");
			
			XmlNode node = indexDoc.DocumentElement.ChildNodes[0];
			
			Assert.AreEqual(threadID.ToString(), node.Attributes["ID"].Value, "The thread doesn't have the expected ID.");
			Assert.AreEqual(title, node.Attributes["Title"].Value, "The thread doesn't have the expected title.");
		}