Esempio n. 1
0
 public static void ProcessDir(DirectoryInfo directoryInfo, string outDir)
 {
     if (!Directory.Exists(outDir)) Directory.CreateDirectory(outDir);
     //
     DirectoryInfo outDirInfo = new DirectoryInfo(outDir);
     //
     // Directories:
     //
     ObsoleteDirs obsoleteDirs = new ObsoleteDirs(outDirInfo);
     foreach (DirectoryInfo subDirectoryInfo in directoryInfo.EnumerateDirectories())
     {
         obsoleteDirs.RemoveDirFromObsoleteList(subDirectoryInfo);
         //
         ProcessDir(subDirectoryInfo, Path.Combine(outDir, subDirectoryInfo.Name));
     }
     obsoleteDirs.DeleteDirs();
     //
     // Files:
     //
     ObsoleteFiles obsoleteFiles = new ObsoleteFiles(outDirInfo);
     foreach (FileInfo fileInfo in directoryInfo.EnumerateFiles())
     {
         string outFileName = processFile(fileInfo, outDir);
         obsoleteFiles.RemoveFileFromObsoleteList(outFileName);
     }
     obsoleteFiles.DeleteFiles();
 }
Esempio n. 2
0
 private bool processDir(TestDirNode testDirNode, DirectoryInfo directoryInfo, string outDir)
 {
     bool result = false;
     //
     if (!Directory.Exists(outDir))
     {
         Directory.CreateDirectory(outDir);
     }
     DirectoryInfo outDirInfo = new DirectoryInfo(outDir);
     //
     // Directories:
     //
     ObsoleteDirs obsoleteDirs = new ObsoleteDirs(outDirInfo);
     foreach (DirectoryInfo subDirectoryInfo in directoryInfo.EnumerateDirectories())
     {
         TestDirNode subTestDirNode = new TestDirNode(subDirectoryInfo.Name);
         if (processDir(subTestDirNode, subDirectoryInfo, Path.Combine(outDir, subDirectoryInfo.Name)))
         {
             obsoleteDirs.RemoveDirFromObsoleteList(subDirectoryInfo);
             testDirNode.AddSubDir(subTestDirNode);
             result = true;
         }
     }
     obsoleteDirs.DeleteDirs();
     //
     // Files:
     //
     ObsoleteFiles obsoleteFiles = new ObsoleteFiles(outDirInfo);
     foreach (FileInfo fileInfo in directoryInfo.EnumerateFiles("*.spec.js"))
     {
         string outFileName = fileInfo.Name + ".html";
         obsoleteFiles.RemoveFileFromObsoleteList(outFileName);
         string fullOutFileName = Path.Combine(outDir, outFileName);
         obsoleteFiles.RemoveFileFromObsoleteList(outFileName);
         //
         //Console.WriteLine(fileInfo.FullName);
         //Console.WriteLine("  " + fullOutFileName);
         //
         TestResultsInfo testResultInfo = RunMocha.Run(fileInfo.FullName, fullOutFileName);
         //TestResultsInfo testResultInfo = new TestResultsInfo();
         //
         //Console.WriteLine(string.Format("total={0} passed={1}", testResultInfo.Total, testResultInfo.Passed));
         TestItemNode itemNode = new TestItemNode() { Name = fileInfo.Name, ResultsInfo = testResultInfo };
         testDirNode.AddItem(itemNode);
         //
         //
         result = true;
     }
     obsoleteFiles.DeleteFiles();
     //
     if (!result)
     {
         Directory.Delete(outDir);
     }
     //
     return result;
 }
Esempio n. 3
0
        // -------------------------------------
        //              processDir()
        // -------------------------------------

        private static void processDir(DirectoryInfo directoryInfo, string outDir)
        {
            if (!Directory.Exists(outDir))
            {
                Directory.CreateDirectory(outDir);
            }
            DirectoryInfo outDirInfo = new DirectoryInfo(outDir);
            //
            // Directories:
            //
            ObsoleteDirs obsoleteDirs = new ObsoleteDirs(outDirInfo);
            foreach (DirectoryInfo subDirectoryInfo in directoryInfo.EnumerateDirectories())
            {
                obsoleteDirs.RemoveDirFromObsoleteList(subDirectoryInfo);
                //
                processDir(subDirectoryInfo, Path.Combine(outDir, subDirectoryInfo.Name));
            }
            obsoleteDirs.DeleteDirs();
            //
            // Files:
            //
            ObsoleteFiles obsoleteFiles = new ObsoleteFiles(outDirInfo);
            foreach (FileInfo fileInfo in directoryInfo.EnumerateFiles())
            {
                //obsoleteFiles.RemoveFileFromObsoleteList(fileInfo);
                //
                string contentHtml = File.ReadAllText(fileInfo.FullName);
                //
                string outFileName = Path.ChangeExtension(fileInfo.Name, ".html");
                obsoleteFiles.RemoveFileFromObsoleteList(outFileName);
                string fullOutFileName = Path.Combine(outDir, outFileName);
                //
                writePage(fullOutFileName, contentHtml);
            }
            obsoleteFiles.DeleteFiles();
        }