Exemplo n.º 1
0
        public static TransientZipArchive Create(TransientTestFolder source, TransientTestFolder destination, string filename = "test.zip")
        {
            Directory.CreateDirectory(destination.Path);

            string path = System.IO.Path.Combine(destination.Path, filename);

            ZipFile.CreateFromDirectory(source.Path, path);

            return(new TransientZipArchive
            {
                Path = path
            });
        }
Exemplo n.º 2
0
        public TransientTestProjectWithFiles(
            string projectFileName,
            string projectContents,
            string[] files,
            string relativePathFromRootToProject = ".")
        {
            _folder = new TransientTestFolder();

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

            Directory.CreateDirectory(projectDir);

            ProjectFile = Path.GetFullPath(Path.Combine(projectDir, projectFileName));
            File.WriteAllText(ProjectFile, ObjectModelHelpers.CleanupFileContents(projectContents));

            CreatedFiles = Helpers.CreateFilesInDirectory(TestRoot, files);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Create a temp file name under a specific temporary folder. The file is expected to exist when the test completes.
 /// </summary>
 /// <param name="transientTestFolder">Temp folder</param>
 /// <param name="extension">Extension of the file (defaults to '.tmp')</param>
 /// <returns></returns>
 public TransientTestFile ExpectFile(TransientTestFolder transientTestFolder, string extension = ".tmp")
 {
     return(WithTransientTestState(new TransientTestFile(transientTestFolder.Path, extension, createFile: false, expectedAsOutput: true)));
 }
Exemplo n.º 4
0
 public TransientTestFile CreateFile(TransientTestFolder transientTestFolder, string fileName, string contents = "")
 {
     return(WithTransientTestState(new TransientTestFile(transientTestFolder.Path, fileName, contents)));
 }