public void SaveMakesProjectNotDirty() { project.Save(xmlfile); Assert.IsFalse(project.IsDirty); }
public void SaveEmptyProject() { project.Save(xmlfile); CheckContents(NUnitProjectXml.EmptyProject); }
public void EditProject() { NUnitProject project = loader.TestProject; string editorPath = (string)Services.UserSettings.GetSetting("Options.ProjectEditor.EditorPath"); bool pathSpecified = editorPath != null; if (!pathSpecified) { editorPath = Path.Combine(NUnitConfiguration.NUnitBinDirectory, "nunit-editor.exe"); } if (!File.Exists(editorPath)) { string NL = Environment.NewLine; string message = "Unable to locate the Project Editor:" + NL + NL + editorPath + NL + NL + (pathSpecified ? "Verify that you have set the path to the editor correctly." : "Verify that nunit.editor.exe is properly installed in the NUnit bin directory."); Form.MessageDisplay.Error(message); return; } if (!NUnitProject.IsNUnitProjectFile(project.ProjectPath)) { if (Form.MessageDisplay.Display( "The project has not yet been saved. In order to edit the project, it must first be saved. Click OK to save the project or Cancel to exit.", MessageBoxButtons.OKCancel) == DialogResult.OK) { project.Save(); } } else if (!File.Exists(project.ProjectPath)) { project.Save(); } else if (project.IsDirty) { switch (Form.MessageDisplay.Ask( "There are unsaved changes. Do you want to save them before running the editor?", MessageBoxButtons.YesNoCancel)) { case DialogResult.Yes: project.Save(); break; case DialogResult.Cancel: return; } } // In case we tried to save project and failed if (NUnitProject.IsNUnitProjectFile(project.ProjectPath) && File.Exists(project.ProjectPath)) { Process p = new Process(); p.StartInfo.FileName = Quoted(editorPath); p.StartInfo.Arguments = Quoted(project.ProjectPath); p.Start(); } }