public TestAssetInstance(TestAssetInfo testAssetInfo, DirectoryInfo root) { if (testAssetInfo == null) { throw new ArgumentException(nameof(testAssetInfo)); } if (root == null) { throw new ArgumentException(nameof(root)); } TestAssetInfo = testAssetInfo; Root = root; MigrationBackupRoot = new DirectoryInfo(Path.Combine(root.Parent.FullName, "backup")); if (Root.Exists) { Root.Delete(recursive: true); } Root.Create(); if (MigrationBackupRoot.Exists) { MigrationBackupRoot.Delete(recursive: true); } }
public TestAssetInstance(TestAssetInfo testAssetInfo, DirectoryInfo root) { _testAssetInfo = testAssetInfo; _root = root; if (root.Exists) { root.Delete(recursive: true); } root.Create(); }
public TestAssetInstance(TestAssetInfo testAssetInfo, DirectoryInfo root) { if (testAssetInfo == null) { throw new ArgumentException(nameof(testAssetInfo)); } if (root == null) { throw new ArgumentException(nameof(root)); } TestAssetInfo = testAssetInfo; Root = root; MigrationBackupRoot = new DirectoryInfo(Path.Combine(root.Parent.FullName, "backup")); if (Root.Exists) { try { Root.Delete(recursive: true); } catch (IOException ex) { throw new InvalidOperationException("Unable to delete directory: " + Root.FullName, ex); } } Root.Create(); if (MigrationBackupRoot.Exists) { MigrationBackupRoot.Delete(recursive: true); } }