Exemple #1
0
 public void ThrowIfCannotCreateDestination()
 {
     Assert.Throws <ApplicationException>(() =>
                                          BackupMaker.BackupToExternal(BasilProject.GetPretendProjectDirectory(),
                                                                       "QQ:\\" + Path.GetRandomFileName(),
                                                                       _filesToBackup));
 }
Exemple #2
0
        public void OverwritesExistingZip()
        {
            string dummyPath = MakeDummyExistingZip();

            try
            {
                BackupMaker.BackupToExternal(_sourceProjectPath, _destinationZip, _filesToBackup);
                AssertHasReasonableContents();
                AssertDoesNotContainFile(dummyPath);
            }
            finally
            {
                File.Delete(dummyPath);
            }
        }
Exemple #3
0
        public void BackupToExternal_FileToBackUpIsLocked_Throws()
        {
            using (var folderForBackup = new TemporaryFolder("Backup Test"))
            {
                string backUpFileName = Path.Combine(folderForBackup.Path, "Backup Test.zip");

                //Create and lock a lift file
                var fileToBackUp = new TempLiftFile("TempLiftFile.lift", folderForBackup, "", "0.13");

                //This is our lock
                var liftFileStreamForLocking = new FileStream(
                    fileToBackUp.Path, FileMode.Open, FileAccess.Read, FileShare.None
                    );

                Assert.Throws <System.IO.IOException>(
                    () => BackupMaker.BackupToExternal(
                        Path.GetDirectoryName(fileToBackUp.Path), backUpFileName, new[] { fileToBackUp.Path }
                        )
                    );
                liftFileStreamForLocking.Close();
            }
        }
Exemple #4
0
 public void ThrowIfSourceDoesntExist()
 {
     Assert.Throws <ApplicationException>(() => BackupMaker.BackupToExternal(Path.GetRandomFileName(), _destinationZip, _filesToBackup));
 }
Exemple #5
0
 public void OkIfNoFilesChosen()
 {
     BackupMaker.BackupToExternal(_sourceProjectPath, _destinationZip, new string[] {});
 }
Exemple #6
0
 public void SelectsCorrectFiles()
 {
     BackupMaker.BackupToExternal(_sourceProjectPath, _destinationZip, _filesToBackup);
     AssertHasReasonableContents();
 }