public void PurgeDeletesSoftDeletesNoTimestamp() { File.VoidCreate(); SoftDelete.VoidCreate(); Backup.VoidCreate(); _backuper.AfterSuccessfulSave(File); AssertFile.Exists(true, File); AssertFile.Exists(true, Backup); AssertFile.Exists(false, SoftDelete); }
public void PurgeDeletesSoftDeletes() { foreach (var backup in TimestampedBackups) { backup.VoidCreate(); } SoftDelete.VoidCreate(); File.VoidCreate(); Backup.VoidCreate(); Setting.NumberOfBackups = int.MaxValue; Setting.MaxAgeInDays = int.MaxValue; _backuper.AfterSuccessfulSave(File); AssertFile.Exists(true, File); AssertFile.Exists(true, Backup); AssertFile.Exists(false, SoftDelete); }
public void TryRestoreWhenHasBackupAndOriginal() { File.WriteAllText("File"); SoftDelete.VoidCreate(); Backup.VoidCreate(); AssertFile.Exists(true, File); AssertFile.Exists(true, SoftDelete); AssertFile.Exists(true, Backup); Assert.Throws <InvalidOperationException>(() => _backuper.TryRestore(File)); AssertFile.Exists(true, File); AssertFile.Exists(true, SoftDelete); AssertFile.Exists(true, Backup); }
public void PurgeOld() { SoftDelete.VoidCreate(); foreach (var backup in TimestampedBackups) { backup.VoidCreate(); } Setting.TimeStampFormat = BackupSettings.DefaultTimeStampFormat; Setting.NumberOfBackups = int.MaxValue; Setting.MaxAgeInDays = 2; _backuper.AfterSuccessfulSave(File); AssertFile.Exists(true, BackupOneMinuteOld); AssertFile.Exists(true, BackupOneHourOld); AssertFile.Exists(true, BackupOneDayOld); AssertFile.Exists(false, BackupOneMonthOld); AssertFile.Exists(false, BackupOneYearOld); AssertFile.Exists(false, SoftDelete); }
public void PurgeWhenHasSoftDelete() { File.VoidCreate(); SoftDelete.VoidCreate(); foreach (var backup in TimestampedBackups) { backup.VoidCreate(); } Setting.NumberOfBackups = 3; Setting.MaxAgeInDays = int.MaxValue; _backuper.AfterSuccessfulSave(File); AssertFile.Exists(true, File); AssertFile.Exists(true, BackupOneMinuteOld); AssertFile.Exists(true, BackupOneHourOld); AssertFile.Exists(true, BackupOneDayOld); AssertFile.Exists(true, BackupOneMonthOld); AssertFile.Exists(true, BackupOneYearOld); AssertFile.Exists(false, SoftDelete); }