public void RestoreProjectSettings_VerifyExistenceOfHgRepo() { string restoreTestsZipFileDir = Path.Combine(FwDirectoryFinder.SourceDirectory, "FDO/FDOTests/BackupRestore/RestoreServiceTestsZipFileDir"); RestoreProjectSettings restoreSettings = new RestoreProjectSettings(FwDirectoryFinder.ProjectsDirectory) { Backup = new BackupFileSettings(Path.Combine(restoreTestsZipFileDir, Path.ChangeExtension("TestRestoreFWProject", FdoFileHelper.ksFwBackupFileExtension))), IncludeConfigurationSettings = false, IncludeLinkedFiles = false, IncludeSupportingFiles = true, IncludeSpellCheckAdditions = false, ProjectName = "TestRestoreFWProject 01", BackupOfExistingProjectRequested = false, }; ProjectRestoreService restoreProjectService = new ProjectRestoreService(restoreSettings, new DummyFdoUI(), FwDirectoryFinder.ConverterConsoleExe, FwDirectoryFinder.DbExe); try { // Restore the project and check to ensure that it exists, but is not using Send/Receive. restoreProjectService.RestoreProject(new DummyProgressDlg()); Assert.True(restoreSettings.ProjectExists, "Project does not exist but it should."); Assert.False(restoreSettings.UsingSendReceive, "Project is using S/R but it should not be."); string otherReposDir = Path.Combine(restoreSettings.ProjectPath, FdoFileHelper.OtherRepositories); // Create a non-repository folder in OtherRepositories and verify the project is not using Send/Receive Directory.CreateDirectory(Path.Combine(otherReposDir, "NotARepo_LIFT", "RandomSubdir")); Assert.False(restoreSettings.UsingSendReceive, "Project should not be using S/R if there is no hg repo in OtherRepositories."); // Create a hg repository in OtherRepositories and verify the project is using Send/Receive Directory.CreateDirectory(Path.Combine(otherReposDir, "IsARepo_ButNotNecessarilyLIFT", ".hg")); Assert.True(restoreSettings.UsingSendReceive, "Project should be using S/R if there is a hg repo in OtherRepositories."); Directory.Delete(otherReposDir, true); Assert.False(restoreSettings.UsingSendReceive, "Project should not be using S/R if there is no hg repo. Deletion failed?"); // Make the project directory a hg repo Directory.CreateDirectory(Path.Combine(restoreSettings.ProjectPath, ".hg")); Assert.True(restoreSettings.UsingSendReceive, "Project should be using S/R if the project directory is a hg repo."); } finally { ProjectRestoreServiceTests.RemoveAnyFilesAndFoldersCreatedByTests(restoreSettings); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="RestoreProjectDlg"/> class. /// </summary> /// <param name="helpTopicProvider">The help topic provider.</param> /// ------------------------------------------------------------------------------------ private RestoreProjectDlg(IHelpTopicProvider helpTopicProvider) : this() { m_helpTopicProvider = helpTopicProvider; m_lblOtherBackupIncludes.Text = String.Empty; m_lblDefaultBackupIncludes.Text = String.Empty; m_lblBackupZipFile.Text = String.Empty; m_lblBackupProjectName.Text = String.Empty; m_lblBackupDate.Text = String.Empty; m_lblBackupComment.Text = String.Empty; m_fmtUseOriginalName = m_rdoUseOriginalName.Text; m_rdoUseOriginalName.Text = String.Format(m_fmtUseOriginalName, String.Empty); m_settings = new RestoreProjectSettings(FwDirectoryFinder.ProjectsDirectory); m_txtOtherProjectName.KeyPress += m_txtOtherProjectName_KeyPress; m_txtOtherProjectName.TextChanged += m_txtOtherProjectName_TextChanged; GetIllegalProjectNameChars(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructor. /// </summary> /// ------------------------------------------------------------------------------------ public MissingOldFieldWorksDlg(RestoreProjectSettings settings, bool fHaveFw60, bool fHaveSqlSvr) : this() { Debug.Assert(!fHaveFw60 || !fHaveSqlSvr); if (fHaveFw60) { m_labelFwDownload.Visible = false; m_lnkFw60.Visible = false; } if (fHaveSqlSvr) { m_labelSqlDownload.Visible = false; m_lnkSqlSvr.Visible = false; } m_lblBackupFile.Text = settings.Backup.File; }
public void Initialize() { var restoreTestsZipFileDir = Path.Combine(FwDirectoryFinder.SourceDirectory, "FDO", "FDOTests", "BackupRestore", "RestoreServiceTestsZipFileDir"); m_restoreSettings = new RestoreProjectSettings(FwDirectoryFinder.ProjectsDirectory) { Backup = new BackupFileSettings(Path.Combine(restoreTestsZipFileDir, Path.ChangeExtension("TestRestoreFWProject", FdoFileHelper.ksFwBackupFileExtension))), IncludeConfigurationSettings = false, IncludeLinkedFiles = false, IncludeSupportingFiles = false, IncludeSpellCheckAdditions = false, ProjectName = "TestRestoreFWProject", BackupOfExistingProjectRequested = false, }; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="RestoreProjectDlg"/> class. /// </summary> /// <param name="appName">Name of the application (for showing in message box captions).</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// ------------------------------------------------------------------------------------ private RestoreProjectDlg(string appName, IHelpTopicProvider helpTopicProvider) : this() { m_appName = appName; m_helpTopicProvider = helpTopicProvider; m_lblOtherBackupIncludes.Text = string.Empty; m_lblDefaultBackupIncludes.Text = string.Empty; m_lblBackupZipFile.Text = string.Empty; m_lblBackupProjectName.Text = string.Empty; m_lblBackupDate.Text = string.Empty; m_lblBackupComment.Text = string.Empty; m_fmtUseOriginalName = m_rdoUseOriginalName.Text; m_rdoUseOriginalName.Text = String.Format(m_fmtUseOriginalName, String.Empty); m_settings = new RestoreProjectSettings(); m_txtOtherProjectName.KeyPress += new KeyPressEventHandler(m_txtOtherProjectName_KeyPress); m_txtOtherProjectName.TextChanged += new EventHandler(m_txtOtherProjectName_TextChanged); GetIllegalProjectNameChars(); }
public void Initialize() { string restoreTestsZipFileDir = Path.Combine(DirectoryFinder.FwSourceDirectory, "FDO/FDOTests/BackupRestore/RestoreServiceTestsZipFileDir"); m_restoreSettings = new RestoreProjectSettings() { Backup = new BackupFileSettings(Path.Combine(restoreTestsZipFileDir, Path.ChangeExtension("TestRestoreFWProject", FwFileExtensions.ksFwBackupFileExtension))), IncludeConfigurationSettings = false, IncludeLinkedFiles = false, IncludeSupportingFiles = false, IncludeSpellCheckAdditions = false, ProjectName = "TestRestoreFWProject", BackupOfExistingProjectRequested = false, }; }
public void RestoreProjectSettings_CommandLineOptions() { RestoreProjectSettings settings = new RestoreProjectSettings(); Assert.AreEqual(string.Empty, settings.CommandLineOptions); settings.IncludeConfigurationSettings = true; Assert.AreEqual("c", settings.CommandLineOptions.ToLower()); settings.IncludeSupportingFiles = true; Assert.AreEqual("cf", settings.CommandLineOptions.ToLower()); settings.IncludeLinkedFiles = true; Assert.AreEqual("cfl", settings.CommandLineOptions.ToLower()); settings.IncludeSpellCheckAdditions = true; Assert.AreEqual("cfls", settings.CommandLineOptions.ToLower()); settings.IncludeSupportingFiles = false; Assert.AreEqual("cls", settings.CommandLineOptions.ToLower()); settings.IncludeSpellCheckAdditions = false; Assert.AreEqual("cl", settings.CommandLineOptions.ToLower()); settings.IncludeConfigurationSettings = false; Assert.AreEqual("l", settings.CommandLineOptions.ToLower()); }
public void RestoreProjectSettings_VerifyExistanceOfProject() { string restoreTestsZipFileDir = Path.Combine(DirectoryFinder.FwSourceDirectory, "FDO/FDOTests/BackupRestore/RestoreServiceTestsZipFileDir"); RestoreProjectSettings restoreSettings = new RestoreProjectSettings() { Backup = new BackupFileSettings(Path.Combine(restoreTestsZipFileDir, Path.ChangeExtension("TestRestoreFWProject", FwFileExtensions.ksFwBackupFileExtension))), IncludeConfigurationSettings = false, IncludeLinkedFiles = false, IncludeSupportingFiles = true, IncludeSpellCheckAdditions = false, ProjectName = "TestRestoreFWProject", BackupOfExistingProjectRequested = false, }; restoreSettings.ProjectName = "TestRestoreFWProject 01"; restoreSettings.IncludeConfigurationSettings = false; ProjectRestoreServiceTests.RemoveAnyFilesAndFoldersCreatedByTests(restoreSettings); ProjectRestoreService restoreProjectService = new ProjectRestoreService(restoreSettings); Assert.False(restoreSettings.ProjectExists, "Project exists but it should not."); try { // Restore the project and check to ensure that it exists. restoreProjectService.RestoreProject(new DummyProgressDlg()); Assert.True(restoreSettings.ProjectExists, "Project does not exist but it should."); } finally { ProjectRestoreServiceTests.RemoveAnyFilesAndFoldersCreatedByTests(restoreSettings); } }
/// <summary> /// Provide a version of the basic ProjectRestoreService that overrides some UI /// we don't want to show up in tests (a dialog). /// </summary> /// <param name="settings"></param> public ProjectRestoreTestService(RestoreProjectSettings settings) : base(settings, new DummyFdoUI(), FwDirectoryFinder.ConverterConsoleExe, FwDirectoryFinder.DbExe) { PutFilesInProject = false; SimulateOKResult = true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="FwRestoreProjectSettings"/> class. /// </summary> /// <param name="fwAppCommandLineAbbrev">The FW application command line abbrev (TE or /// FLEx), case-insensitive.</param> /// <param name="settings">The restore settings (as saved by the dialog).</param> /// ------------------------------------------------------------------------------------ internal FwRestoreProjectSettings(string fwAppCommandLineAbbrev, RestoreProjectSettings settings) { m_fwAppCommandLineAbbrev = fwAppCommandLineAbbrev; m_settings = settings; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="FwRestoreProjectSettings"/> class. /// </summary> /// <param name="settings">The restore settings (as saved by the dialog).</param> /// ------------------------------------------------------------------------------------ internal FwRestoreProjectSettings(RestoreProjectSettings settings) { m_settings = settings; }