public void DirectoryBackupOperation_Backup_BackupPath_SubDirectoriesExist() { var mockFileSystem = new MockFileSystem(); TxFileSystem txFileSystem = null; using (var transactionScope = new TransactionScope()) { txFileSystem = new TxFileSystem(mockFileSystem); txFileSystem.Directory.CreateDirectory("/tmp/directorytobackupped"); for (var i = 1; i <= 3; i++) { txFileSystem.Directory.CreateDirectory("/tmp/directorytobackupped/subdir_" + i.ToString()); } var unitTestOperation = new UnitTestDirectoryOperation(txFileSystem.Directory, "/tmp/directorytobackupped"); unitTestOperation.Backup(); var directories = txFileSystem.Directory.EnumerateDirectories(unitTestOperation.BackupPath); Assert.NotEmpty(directories); Assert.Equal(3, directories.Count()); } }
public void DirectoryBackupOperation_Backup_BackupPathExists_ReturnsTrue() { var mockFileSystem = new MockFileSystem(); TxFileSystem txFileSystem = null; using (var transactionScope = new TransactionScope()) { txFileSystem = new TxFileSystem(mockFileSystem); txFileSystem.Directory.CreateDirectory("/tmp/directorytobackupped"); var unitTestOperation = new UnitTestDirectoryOperation(txFileSystem.Directory, "/tmp/directorytobackupped"); unitTestOperation.Backup(); Assert.True(txFileSystem.Directory.Exists(unitTestOperation.BackupPath)); } }