Ejemplo n.º 1
0
 public void PurgeDeletesSoftDeletesNoTimestamp()
 {
     File.VoidCreate();
     SoftDelete.VoidCreate();
     Backup.VoidCreate();
     _backuper.AfterSuccessfulSave(File);
     AssertFile.Exists(true, File);
     AssertFile.Exists(true, Backup);
     AssertFile.Exists(false, SoftDelete);
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
 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);
 }