public void WorksWhenRenamed() { var originalExe = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sce.exe"); var testDir = TestUtil.GetTestDir(WorksWhenRenamed); var exe = Path.Combine(testDir, "hello.exe"); // ensure that source directory is deleted FS.EnsureDirectoryIsEmpty(testDir); File.Copy(originalExe, exe); var sourceDir = exe + ".src"; // Start first time to create source dir var p = Run(exe); Assert.AreEqual(0, p.Result.process.ExitCode); // modify source var programCs = Path.Combine(sourceDir, "Program.cs"); File.WriteAllText(programCs, @" using System; class Program { internal static int Main(string[] args) { return 123; } } "); // Start second time to recompile and return different exit code p = Run(exe); Assert.AreEqual(123, p.Result.process.ExitCode); // Start third time to remove old-sce-hello.exe p = Run(exe); Assert.AreEqual(123, p.Result.process.ExitCode); // delete the source dir FS.EnsureDirectoryNotExists(sourceDir); // Start to show that without code the default behaviour is restored again p = Run(exe); Assert.AreEqual(0, p.Result.process.ExitCode); Assert.IsTrue(File.Exists(programCs)); }