Ejemplo n.º 1
0
 public SearchReplaceFileReplacer(ISearchReplaceParameter parameters)
 {
     _Replacer = new XmlSearchReplace(
         parameters.GetLocationOptions()
         , parameters.GetOperationOptions()
         , parameters.GetSearchString()
         , parameters.GetReplaceString());
     this._Parameters = parameters;
     _Document        = new XmlDocument();
 }
Ejemplo n.º 2
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]);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }