Esempio n. 1
0
        public TransientTestProjectWithFiles(string projectContents, string[] files,
                                             string relativePathFromRootToProject = ".")
        {
            _folder = new TransientTestFolder();

            var projectDir = Path.Combine(TestRoot, relativePathFromRootToProject);

            Directory.CreateDirectory(projectDir);

            ProjectFile = Path.Combine(projectDir, "build.proj");
            File.WriteAllText(ProjectFile, ObjectModelHelpers.CleanupFileContents(projectContents));

            CreatedFiles = Helpers.CreateFilesInDirectory(TestRoot, files);
        }
Esempio n. 2
0
 /// <summary>
 ///     Creates a test variant that corresponds to a temporary file under a specific temporary folder. File will
 ///     be cleaned up when the test completes.
 /// </summary>
 /// <param name="transientTestFolder"></param>
 /// <param name="extension">Extension of the file (defaults to '.tmp')</param>
 public TransientTestFile CreateFile(TransientTestFolder transientTestFolder, string extension = ".tmp")
 {
     return(WithTransientTestState(new TransientTestFile(transientTestFolder.FolderPath, extension)));
 }