public void NBackup_A_NBackupTest() { if (GetServerVersion() < new Version("2.5.0.0")) { Assert.Inconclusive("Not supported on this version."); return; } Action <int> doLevel = l => { var nbak = new FbNBackup(); nbak.ConnectionString = BuildServicesConnectionString(); nbak.Level = l; nbak.BackupFile = ConfigurationManager.AppSettings["BackupRestoreFile"] + l.ToString(); nbak.DirectIO = true; nbak.Options = FbNBackupFlags.NoDatabaseTriggers; nbak.ServiceOutput += ServiceOutput; nbak.Execute(); }; doLevel(0); doLevel(1); }
public void NBackupBackupRestoreTest() { if (!EnsureVersion(new Version("2.5.0.0"))) { return; } const int Levels = 2; var backupName = $"{Guid.NewGuid().ToString()}.nbak"; void BackupPart() { void DoLevel(int level) { var nbak = new FbNBackup(); nbak.ConnectionString = BuildServicesConnectionString(FbServerType, Compression, true); nbak.Level = level; nbak.BackupFile = backupName + level.ToString(); nbak.DirectIO = true; nbak.Options = FbNBackupFlags.NoDatabaseTriggers; nbak.ServiceOutput += ServiceOutput; nbak.Execute(); } for (int i = 0; i < Levels; i++) { DoLevel(i); } } void RestorePart() { FbConnection.DropDatabase(BuildConnectionString(FbServerType, Compression)); var nrest = new FbNRestore(); nrest.ConnectionString = BuildServicesConnectionString(FbServerType, Compression, true); nrest.BackupFiles = Enumerable.Range(0, Levels).Select(l => backupName + l.ToString()); nrest.DirectIO = true; nrest.ServiceOutput += ServiceOutput; nrest.Execute(); } BackupPart(); RestorePart(); }
void NBackupBackupRestoreTest_BackupPart() { Action <int> doLevel = l => { var nbak = new FbNBackup(); nbak.ConnectionString = BuildServicesConnectionString(FbServerType); nbak.Level = l; nbak.BackupFile = TestsSetup.BackupRestoreFile + l.ToString(); nbak.DirectIO = true; nbak.Options = FbNBackupFlags.NoDatabaseTriggers; nbak.ServiceOutput += ServiceOutput; nbak.Execute(); }; doLevel(0); doLevel(1); }