public void Test_ReplaceInDirectoryName() { Console.WriteLine(""); Console.WriteLine("Preparing test"); Console.WriteLine(""); var directoryName = "hello"; var directoryPath = Path.GetFullPath(directoryName); var fileName = "hello.txt"; var oldValue = "hello"; var newValue = "hi"; Directory.CreateDirectory(Path.GetFullPath(directoryName)); var filePath = Path.GetFullPath(directoryName + "/" + 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.ReplaceInDirectoryName(directoryPath, oldValue, newValue); Console.WriteLine(""); Console.WriteLine("Analysing test"); Console.WriteLine(""); var newDirectoryPath = directoryPath.Replace(oldValue, newValue); var newFilePath = Path.Combine(newDirectoryPath, fileName); Assert.IsTrue(Directory.Exists(newDirectoryPath)); Assert.IsFalse(Directory.Exists(directoryPath)); var newContent = File.ReadAllText(newFilePath); var expectedContent = "hello world"; Assert.AreEqual(expectedContent, newContent); }