public void Test_ReplaceInFileName() { Console.WriteLine(""); Console.WriteLine("Preparing test"); Console.WriteLine(""); var fileName = "hello.txt"; var oldValue = "hello"; var newValue = "hi"; var filePath = Path.GetFullPath(fileName); File.WriteAllText(filePath, "hello world"); var replacer = new Replacer(Environment.CurrentDirectory); replacer.IsVerbose = true; replacer.CommitChanges = true; Console.WriteLine(""); Console.WriteLine("Executing test"); Console.WriteLine(""); replacer.ReplaceInFileName(filePath, oldValue, newValue); Console.WriteLine(""); Console.WriteLine("Analysing test"); Console.WriteLine(""); var newFilePath = filePath.Replace(oldValue, newValue); Assert.IsTrue(File.Exists(newFilePath)); var newContent = File.ReadAllText(newFilePath); var expectedContent = "hello world"; Assert.AreEqual(expectedContent, newContent); }