コード例 #1
0
        public void SomeFilesInFolder()
        {
            CodeCommentSymbols fileSettings = new CodeCommentSymbols(Environment.CurrentDirectory + "\\..\\..\\Ressources\\FolderToWaterMark\\CommentSymbols.txt");
            FolderToWatermark  folderToMark = new FolderToWatermark(Environment.CurrentDirectory + "\\..\\..\\Ressources\\FolderToWaterMark\\SomeFilesToRead", fileSettings, mark);

            Assert.AreEqual(3, folderToMark.FilesToProcessCount);
            Assert.AreEqual(0, folderToMark.FilesProcessedCount);
        }
コード例 #2
0
        public void SettingsFileExtraEmptyLines()
        {
            CodeCommentSymbols fileSettings = new CodeCommentSymbols(Environment.CurrentDirectory + "\\..\\..\\Ressources\\CommentSymbols-ExtraEmptyLines.txt");

            Assert.AreEqual(6, fileSettings.CommentSymbols.Count());
            Assert.IsNotNull(fileSettings.CommentSymbols[".master"]);
            Assert.AreEqual(fileSettings.CommentSymbols[".master"].Item1, "<%--");
            Assert.AreEqual(fileSettings.CommentSymbols[".master"].Item2, "--%>");
        }
コード例 #3
0
        public void SettingsFileOneWithExtraSpaces()
        {
            CodeCommentSymbols fileSettings = new CodeCommentSymbols(Environment.CurrentDirectory + "\\..\\..\\Ressources\\CommentSymbols-1-ExtraSpaces.txt");

            Assert.AreEqual(1, fileSettings.CommentSymbols.Count());
            Assert.IsNotNull(fileSettings.CommentSymbols[".css"]);
            Assert.AreEqual("/*", fileSettings.CommentSymbols[".css"].Item1);
            Assert.AreEqual("*/", fileSettings.CommentSymbols[".css"].Item2);
        }
コード例 #4
0
        public void SettingsFileTwo()
        {
            CodeCommentSymbols fileSettings = new CodeCommentSymbols(Environment.CurrentDirectory + "\\..\\..\\Ressources\\CommentSymbols-2.txt");

            Assert.AreEqual(2, fileSettings.CommentSymbols.Count());
            Assert.IsNotNull(fileSettings.CommentSymbols[".cs"]);
            Assert.AreEqual("//", fileSettings.CommentSymbols[".cs"].Item1);
            Assert.AreEqual(String.Empty, fileSettings.CommentSymbols[".cs"].Item2);

            Assert.IsNotNull(fileSettings.CommentSymbols[".js"]);
            Assert.AreEqual("/*", fileSettings.CommentSymbols[".js"].Item1);
            Assert.AreEqual("*/", fileSettings.CommentSymbols[".js"].Item2);
        }
コード例 #5
0
        public void SettingsFileTabsBetweenItems()
        {
            CodeCommentSymbols fileSettings = new CodeCommentSymbols(Environment.CurrentDirectory + "\\..\\..\\Ressources\\CommentSymbols-Tabs.txt");

            Assert.AreEqual(2, fileSettings.CommentSymbols.Count());

            Assert.IsNotNull(fileSettings.CommentSymbols[".css"]);
            Assert.AreEqual(fileSettings.CommentSymbols[".css"].Item1, "/*");
            Assert.AreEqual(fileSettings.CommentSymbols[".css"].Item2, "*/");

            Assert.IsNotNull(fileSettings.CommentSymbols[".cs"]);
            Assert.AreEqual(fileSettings.CommentSymbols[".cs"].Item1, "//");
            Assert.AreEqual(fileSettings.CommentSymbols[".cs"].Item2, String.Empty);
        }
コード例 #6
0
        public void WatermarkValidFiles()
        {
            // Copy non watermarked files over
            foreach (var file in Directory.GetFiles(Environment.CurrentDirectory + "\\..\\..\\Ressources\\FolderToWaterMark\\SomeFilesToRead"))
            {
                File.Copy(file, Path.Combine(Environment.CurrentDirectory + "\\..\\..\\Ressources\\FolderToWaterMark\\SomeFilesToWatermark", Path.GetFileName(file)), true);
            }

            CodeCommentSymbols fileSettings = new CodeCommentSymbols(Environment.CurrentDirectory + "\\..\\..\\Ressources\\FolderToWaterMark\\CommentSymbols.txt");
            FolderToWatermark  folderToMark = new FolderToWatermark(Environment.CurrentDirectory + "\\..\\..\\Ressources\\FolderToWaterMark\\SomeFilesToWatermark", fileSettings, mark);

            Assert.AreEqual(3, folderToMark.FilesToProcessCount);
            Assert.AreEqual(0, folderToMark.FilesProcessedCount);

            folderToMark.WaterMarkFiles();

            //Assert.AreEqual(0, folderToMark.FilesToProcessCount);
            //Assert.AreEqual(3, folderToMark.FilesProcessedCount);
            //Assert.AreNotEqual(0, folderToMark.ThreadsUsedToProcessFiles);

            // Delete watermarked files
            //foreach (var file in Directory.GetFiles(Environment.CurrentDirectory + "\\..\\..\\Ressources\\FolderToWaterMark\\SomeFilesToWatermark"))
            //    File.Delete(file);
        }
コード例 #7
0
 public void FileSettingsIsNull()
 {
     CodeCommentSymbols fileSettings = null;
     FolderToWatermark  folderToMark = new FolderToWatermark(Environment.CurrentDirectory + "\\..\\..\\Ressources\\FolderToWaterMark\\", fileSettings, mark);
 }
コード例 #8
0
 public void FolderDoesNotExist()
 {
     CodeCommentSymbols fileSettings = new CodeCommentSymbols(String.Empty);
     FolderToWatermark  folderToMark = new FolderToWatermark("Folder does not exist", fileSettings, mark);
 }
コード例 #9
0
 public void FolderIsEmpty()
 {
     CodeCommentSymbols fileSettings = new CodeCommentSymbols(String.Empty);
     FolderToWatermark  folderToMark = new FolderToWatermark(String.Empty, fileSettings, mark);
 }
コード例 #10
0
        public void SettingsFileInvalidFormat()
        {
            CodeCommentSymbols fileSettings = new CodeCommentSymbols(Environment.CurrentDirectory + "\\..\\..\\Ressources\\CommentSymbols-InvalidFormat.txt");

            Assert.AreEqual(0, fileSettings.CommentSymbols.Count());
        }
コード例 #11
0
        public void SettingsFileExists()
        {
            CodeCommentSymbols fileSettings = new CodeCommentSymbols(Environment.CurrentDirectory + "\\..\\..\\Ressources\\CommentSymbols-Empty.txt");

            Assert.IsTrue(fileSettings.SettingFileWasLoaded);
        }
コード例 #12
0
        public void SettingsFileDoesNotExist()
        {
            CodeCommentSymbols fileSettings = new CodeCommentSymbols("file does not exist");

            Assert.IsFalse(fileSettings.SettingFileWasLoaded);
        }