Ejemplo n.º 1
0
		public void GetLastLogFileName()
		{
			string[] testFilenames = {"log123.xml", "log200.xml", "logfile.txt", 
										 "log20010830164057Lbuild.6.xml", 
										 "log20011230164057Lbuild.8.xml", 
										 "log20010430164057Lbuild.7.xml", 
										 "badfile.xml" };
			using (TempDirectory tempPath = new TempDirectory())
			{
				CreateTempFiles(tempPath, testFilenames);
				string logfile = LogFileUtil.GetLatestLogFileName(tempPath.ToString());
				Assert.AreEqual("log20011230164057Lbuild.8.xml", logfile);
			}
		}
Ejemplo n.º 2
0
		public void ListFiles() 
		{
			// testFilenames array must be in sorted order -- otherwise links iteration will fail
			string[] testFilenames = {"log123.xml", "log200.xml", "logfile.txt", 
										 "log20020830164057Lbuild.6.xml", "badfile.xml" };
			
			using (TempDirectory tempPath = new TempDirectory())
			{
				CreateTempFiles(tempPath, testFilenames);
				string[] fileNames = LogFileUtil.GetLogFileNames(tempPath.ToString());
				Assert.AreEqual(3,fileNames.Length);
				Assert.AreEqual(testFilenames[0],fileNames[0]);
				Assert.AreEqual(testFilenames[1],fileNames[1]);
			}
		}
Ejemplo n.º 3
0
		public void GetLastBuildDate()
		{
			string[] testFilenames = {"log123.xml", "log200.xml", "logfile.txt", 
										 "log20010830164057Lbuild.6.xml", 
										 "log20011230164057Lbuild.6.xml", 
										 "log20010430164057Lbuild.6.xml", 
										 "badfile.xml" };
			using (TempDirectory tempPath = new TempDirectory())
			{
				CreateTempFiles(tempPath, testFilenames);
				DateTime expected = new DateTime(2001,12,30,16,40,57);
				DateTime actual = LogFileUtil.GetLastBuildDate(tempPath.ToString(), new DateTime());
				Assert.AreEqual(expected, actual);
			}
		}
Ejemplo n.º 4
0
		public void GetLastBuildDate_NoFiles()
		{
			using (TempDirectory tempDir = new TempDirectory())
			{				
				Assert.AreEqual(new DateTime(), LogFileUtil.GetLastBuildDate(tempDir.ToString(), new DateTime()));
			}
		}
Ejemplo n.º 5
0
		public void GetLastLogFileName_EmptyFolder()
		{
			using (TempDirectory tempDir = new TempDirectory())
			{
				Assert.IsNull(LogFileUtil.GetLatestLogFileName(tempDir.ToString()));
			}
		}