/// <summary> /// Creates a file in this directory. /// </summary> /// <param name="name">File name.</param> public TempFile CreateFile(string name) { string filePath = System.IO.Path.Combine(_path, name); TempRoot.CreateStream(filePath); return(_root.AddFile(new DisposableFile(filePath))); }
// Run output in directory set up by SetupDirectory private void RunOutput(TempRoot root, TempDirectory dir, int i) { var exeFile = root.AddFile(GetResultFile(dir, string.Format("hellocs{0}.exe", i))); var runningResult = RunCompilerOutput(exeFile); Assert.Equal(string.Format("CS Hello number {0}\r\n", i), runningResult.Output); exeFile = root.AddFile(GetResultFile(dir, string.Format("hellovb{0}.exe", i))); runningResult = RunCompilerOutput(exeFile); Assert.Equal(string.Format("VB Hello number {0}\r\n", i), runningResult.Output); }
/// <summary> /// Creates a file in this directory that is a copy of the specified file. /// </summary> public TempFile CopyFile(string originalPath, string name = null) { string filePath = System.IO.Path.Combine(_path, name ?? System.IO.Path.GetFileName(originalPath)); File.Copy(originalPath, filePath); return _root.AddFile(new DisposableFile(filePath)); }