/// <summary> /// Initialize a new FileSystemHelper to a specific directory. /// </summary> /// <param name="testInstance"> /// Reference to the test class (to access its logging). /// </param> /// <param name="rootPath">The root directory.</param> public FileSystemHelper(TestBase testInstance, string rootPath) { Debug.Assert(testInstance != null); Debug.Assert(!string.IsNullOrEmpty(rootPath)); TestInstance = testInstance; // Set the directory and create it if necessary. RootPath = rootPath; if (!Directory.Exists(rootPath)) { Log("Creating directory {0}", rootPath); Directory.CreateDirectory(rootPath); } }
/// <summary> /// Initializes a new FileSystemHelper to a random temp directory. /// </summary> /// <param name="testInstance"> /// Reference to the test class (to access its logging). /// </param> public FileSystemHelper(TestBase testInstance) : this(testInstance, GetTemporaryDirectoryName()) { }