public SearchReplaceFileReplacer(ISearchReplaceParameter parameters) { _Replacer = new XmlSearchReplace( parameters.GetLocationOptions() , parameters.GetOperationOptions() , parameters.GetSearchString() , parameters.GetReplaceString()); this._Parameters = parameters; _Document = new XmlDocument(); }
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); }
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); }