public void ThrowIfCannotCreateDestination() { Assert.Throws <ApplicationException>(() => BackupMaker.BackupToExternal(BasilProject.GetPretendProjectDirectory(), "QQ:\\" + Path.GetRandomFileName(), _filesToBackup)); }
public void OverwritesExistingZip() { string dummyPath = MakeDummyExistingZip(); try { BackupMaker.BackupToExternal(_sourceProjectPath, _destinationZip, _filesToBackup); AssertHasReasonableContents(); AssertDoesNotContainFile(dummyPath); } finally { File.Delete(dummyPath); } }
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(); } }
public void ThrowIfSourceDoesntExist() { Assert.Throws <ApplicationException>(() => BackupMaker.BackupToExternal(Path.GetRandomFileName(), _destinationZip, _filesToBackup)); }
public void OkIfNoFilesChosen() { BackupMaker.BackupToExternal(_sourceProjectPath, _destinationZip, new string[] {}); }
public void SelectsCorrectFiles() { BackupMaker.BackupToExternal(_sourceProjectPath, _destinationZip, _filesToBackup); AssertHasReasonableContents(); }