public void Test_ReplaceInFile() { 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.ReplaceInFile(fileName, oldValue, newValue); replacer.IsVerbose = true; Console.WriteLine(""); Console.WriteLine("Analysing test"); Console.WriteLine(""); Assert.IsTrue(File.Exists(filePath)); var newContent = File.ReadAllText(filePath); var expectedContent = "hi world"; Assert.AreEqual(expectedContent, newContent); }