public void EnsureControllerManagesMainLiftBridgeViewUsingExtantSystemWithNoChangesFromAfar() { var mockedClient = new MockedLiftBridgeClient(_liftBridgeController); Assert.IsFalse(mockedClient.HandledBasicLexiconImport); Assert.IsFalse(mockedClient.HandledImportLexicon); Assert.IsFalse(mockedClient.HandledExportLexicon); var liftProject = new LiftProject("DProject"); _pathToProject = LiftProjectServices.PathToProject(liftProject); Directory.CreateDirectory(_pathToProject); Directory.CreateDirectory(Path.Combine(_pathToProject, ".hg")); var projPath = LiftProjectServices.PathToProject(liftProject); var liftPathname = Path.Combine(projPath, "DProject.lift"); File.WriteAllText(liftPathname, ""); _liftBridgeController.DoSendReceiveForLanguageProject(_parentForm, "DProject"); _mockedExistingSystem.SimulateSendReceiveWithNoChangesFromAfar(); // Should be the existing system view by now. Assert.AreSame(_mockedExistingSystem, _mockedLiftBridgeView.ActiveView); Assert.IsTrue(_mockedExistingSystem.ExportLexiconIsWiredUp); Assert.IsTrue(_mockedExistingSystem.ImportLexiconIsWiredUp); Assert.IsFalse(mockedClient.HandledBasicLexiconImport); Assert.IsFalse(mockedClient.HandledImportLexicon); Assert.IsTrue(mockedClient.HandledExportLexicon); }
/// <summary> /// Do the Send/Receive for the given language project name. /// </summary> /// <exception cref="ArgumentNullException"> /// Thrown if <param name="projectName"/> is null or an empty string. /// </exception> public void DoSendReceiveForLanguageProject(Form parent, string projectName) { if (string.IsNullOrEmpty(projectName)) { throw new ArgumentNullException("projectName"); } Liftproject = _languageProjectGuid == Guid.Empty ? new LiftProject(projectName) // Try to support backwards compatibility. : new LiftProject(projectName, _languageProjectGuid); try { if (LiftProjectServices.ProjectIsShared(Liftproject)) { InstallExistingSystemControl(); } else { InstallNewSystem(); } _liftBridgeView.Show(parent, string.Format(Resources.kTitle, Liftproject.LiftProjectName)); } finally { _liftBridgeView.Dispose(); } }
private LiftProject CreateNewbieProject(string projectName) { var liftProject = new LiftProject(projectName); _pathToProject = LiftProjectServices.PathToProject(liftProject); Directory.CreateDirectory(_pathToProject); return(liftProject); }
internal static void ClearImportFailure(LiftProject liftProject) { var failurePathname = GetNoticePathname(liftProject); if (File.Exists(failurePathname)) { File.Delete(failurePathname); } }
internal static ImportFailureStatus GetFailureStatus(LiftProject liftProject) { var failurePathname = GetNoticePathname(liftProject); if (!File.Exists(failurePathname)) { return(ImportFailureStatus.NoImportNeeded); } var fileContents = File.ReadAllText(failurePathname); return(fileContents.Contains(Resources.kBasicFailureFileContents) ? ImportFailureStatus.BasicImportNeeded : ImportFailureStatus.StandardImportNeeded); }
internal static void RegisterBasicImportFailure(Form parentWindow, LiftProject liftProject) { // The results (of the FLEx inital import failure) will be that Lift Bridge will store the fact of the import failure, // and then protect the repo from damage by another S/R by Flex // by seeing the last import failure, and then requiring the user to re-try the failed import, // using the same LIFT file that had failed, before. // If that re-try attempt also fails, the user will need to continue re-trying the import, // until FLEx is fixed and can do the import. MessageBox.Show(parentWindow, Resources.kBasicImportFailureMessage, Resources.kFlexImportFailureTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); // Write out the failure notice. var failurePathname = GetNoticePathname(liftProject); File.WriteAllText(failurePathname, Resources.kBasicFailureFileContents); }
public void SetSystem(ChorusSystem chorusSystem, LiftProject liftProject) { _chorusSystem = chorusSystem; _liftProject = liftProject; var notesBrowser = _chorusSystem.WinForms.CreateNotesBrowser(); _tpNotes.Controls.Add(notesBrowser); notesBrowser.Dock = DockStyle.Fill; var historyPage = _chorusSystem.WinForms.CreateHistoryPage(); _tpHistory.Controls.Add(historyPage); historyPage.Dock = DockStyle.Fill; //_tpAbout }
public void SetSystem(ChorusSystem chorusSystem, LiftProject liftProject) { ChorusSys = chorusSystem; Project = liftProject; }
public void ProjectHasCorrectName() { var liftProject = new LiftProject("Newbie"); Assert.AreEqual("Newbie", liftProject.LiftProjectName); }
private static string GetNoticePathname(LiftProject liftProject) { return(Path.Combine(Path.GetDirectoryName(liftProject.LiftPathname), FailureFilename)); }