Exemplo n.º 1
0
 public void ProcessAll()
 {
     foreach (string file in Utility.GetApplicableFilesInDir(_Parameters.GetFileName(), _Parameters.RecurseSubDir))
     {
         ProcessFile(file);
     }
 }
Exemplo n.º 2
0
        public void CheckSearchStringReplaceFileName_WithSurroundingDoubleQutoesAndSpaceInsideQuotes_ShouldNotTrimAndGiveStringWithoutQuotes()
        {
            string argument = @"/S=  "" hello world ""   /R=   "" how are you ""   /F=   "" c:\documents and settings\blah blah.html ""   /O=av";

            ISearchReplaceParameter argParser = TestHelper.GetApplicationParameters(argument);

            Assert.AreEqual(" hello world ", argParser.GetSearchString()[0]);
            Assert.AreEqual(" how are you ", argParser.GetReplaceString()[0]);
            Assert.AreEqual(" c:\\documents and settings\\blah blah.html ", argParser.GetFileName());
        }
Exemplo n.º 3
0
        public void CheckSearchStringReplaceFileName_WithSpaceBeforeAndAfterWithoutSurroundingDoubleQutoes_ShouldTrimInput()
        {
            string argument = "/S= hello world /R= how are you /F=  c:\\documents and settings\\blah blah.html  /O=av";

            ISearchReplaceParameter argParser = TestHelper.GetApplicationParameters(argument);

            Assert.AreEqual("hello world", argParser.GetSearchString()[0]);
            Assert.AreEqual("how are you", argParser.GetReplaceString()[0]);
            Assert.AreEqual("c:\\documents and settings\\blah blah.html", argParser.GetFileName());
        }
Exemplo n.º 4
0
        public void CheckArgumentsAreFineWithActualValue()
        {
            string[] args = { "/O=", "av,ev,en,an,ve,va", "/S=\\\\server04\\spfiles", "/R=L:", "/F=c:\\documents", "and", "settings\\desktop\\file.xml" };

            ISearchReplaceParameter argParser = TestHelper.GetParameters(args);

            Assert.AreEqual(SearchReplaceLocationOptions.ReplaceAll, argParser.GetLocationOptions());
            Assert.AreEqual("c:\\documents and settings\\desktop\\file.xml", argParser.GetFileName());
            Assert.AreEqual("\\\\server04\\spfiles", argParser.GetSearchString()[0]);
            Assert.AreEqual("L:", argParser.GetReplaceString()[0]);
        }
Exemplo n.º 5
0
        public void StringArgumentsWithMoreThanOneEqualsSignShouldWork()
        {
            string[] args = { "/O=", "av,ev,en,an,va,ve", @"/R==", "/F=c:\\documents", "and", "settings\\desktop\\file.xml", "/S=Equals /W /i /c" };

            ISearchReplaceParameter parameters = TestHelper.GetParameters(args);

            Assert.AreEqual(SearchReplaceLocationOptions.ReplaceAll, parameters.GetLocationOptions());
            Assert.AreEqual("c:\\documents and settings\\desktop\\file.xml", parameters.GetFileName());
            Assert.AreEqual("Equals", parameters.GetSearchString()[0]);
            Assert.AreEqual("=", parameters.GetReplaceString()[0]);
            Assert.AreEqual(SearchReplaceOperationOptions.CaseInsensitive | SearchReplaceOperationOptions.WholeWordOnly, parameters.GetOperationOptions());
            Assert.AreEqual(true, parameters.ContinueOnError);
        }
Exemplo n.º 6
0
        public void CheckArgumentsAreFine()
        {
            string[] args = { "/O=", "av,ev,en,an,va,ve", "/R=replace ", "/F=c:\\documents", "and", "settings\\desktop\\file.xml", "/S=search /W /i /c" };

            ISearchReplaceParameter param = TestHelper.GetParameters(args);

            Assert.AreEqual(SearchReplaceLocationOptions.ReplaceAll, param.GetLocationOptions());
            Assert.AreEqual("c:\\documents and settings\\desktop\\file.xml", param.GetFileName());
            Assert.AreEqual("search", param.GetSearchString()[0]);
            Assert.AreEqual("replace", param.GetReplaceString()[0]);
            Assert.AreEqual(SearchReplaceOperationOptions.CaseInsensitive | SearchReplaceOperationOptions.WholeWordOnly, param.GetOperationOptions());
            Assert.AreEqual(true, param.ContinueOnError);
        }