public void ExistingProjectFromCommandLineInterface() { string[] args = { "-bugzillaxml", "..\\UnitTests\\artifacts\\single_bug.xml", "-ExistingProject", "..\\UnitTests\\artifacts\\ExistingFileCLI_Test_0.mpp" }; if (System.IO.File.Exists("..\\UnitTests\\artifacts\\ExistingFileCLI_Test_0.mpp")) { System.IO.File.Delete("..\\UnitTests\\artifacts\\ExistingFileCLI_Test_0.mpp"); } System.IO.File.Copy("..\\UnitTests\\artifacts\\MSProject_Test_0.mpp", "..\\UnitTests\\artifacts\\ExistingFileCLI_Test_0.mpp"); MSProject simpleProj = new MSProject(); simpleProj.CommandLineInterface(args); simpleProj = null; Assert.IsTrue(System.IO.File.Exists("..\\UnitTests\\artifacts\\ExistingFileCLI_Test_0.mpp")); System.IO.File.Delete("..\\UnitTests\\artifacts\\ExistingFileCLI_Test_0.mpp"); }
public void SimpleSave() { System.Console.WriteLine(System.IO.Directory.GetCurrentDirectory()); System.Console.WriteLine(System.IO.Path.GetFullPath(System.IO.Directory.GetCurrentDirectory() + "..\\..\\UnitTests\\artifacts\\MSProject_Test_Save.mpp")); String fileName = System.IO.Path.GetFullPath(System.IO.Directory.GetCurrentDirectory() + "..\\..\\UnitTests\\artifacts\\MSProject_Test_Save.mpp"); SimpleProjectInit(); simpleProj.LoadMPP(); simpleProj.SaveProjectFilePath = fileName; // Delete the file which we will try to write to File.Delete(simpleProj.SaveProjectFilePath); simpleProj.SaveMPP(); Assert.IsTrue(File.Exists(simpleProj.SaveProjectFilePath)); SimpleProjectClose(); File.Delete(fileName); simpleProj = null; }
public void CreateSingleProjectTaskFromXML() { SimpleProjectInit(); simpleProj.LoadMPP(); simpleProj.Update(); foreach (Task task in simpleProj.Project.Tasks) { if (task.Number1 == 71) { Assert.AreEqual(String.Compare(task.Name, "Program crashes"), 0); Assert.AreEqual(task.Number1, 71); Assert.AreEqual(task.Priority, 500); Assert.AreEqual(String.Compare(task.Text1, "FUTURE"), 0); Assert.AreEqual(String.Compare(task.ResourceNames, "David McCormack"), 0); } } SimpleProjectClose(); simpleProj = null; }
public static void ProjectSaveFileName(MSProject proj) { SaveFileDialog sfd; sfd = new SaveFileDialog(); sfd.DefaultExt = "*.mpp"; sfd.Filter = "Project files (*.mpp)|*.mpp"; sfd.InitialDirectory = "C:\\"; sfd.CheckFileExists = false; sfd.OverwritePrompt = false; if (sfd.ShowDialog() == DialogResult.OK) { proj.LoadProjectFilePath = sfd.FileName; proj.SaveProjectFilePath = sfd.FileName; } else { throw (new ProjzillaException("Can't use the save file name", ProjzillaExceptionSeverity.Warn)); } }
public static void Generate(MSProject proj) { #region Pre Conditions Debug.Assert(null != proj.LoadProjectFilePath); Debug.Assert(null != proj.SaveProjectFilePath); Debug.Assert(null != proj.InputPath); Debug.Assert(InputDataFormat.None != proj.InputType); #endregion if ((proj.SaveProjectFilePath != null) && (proj.LoadProjectFilePath != null) && (proj.InputPath != null)) { proj.LoadMPP(); proj.Update(); proj.SaveMPP(); proj.Close(); } else { MessageBox.Show("Unable to load one of {LoadProjectFilePath, SaveProjectFilePath, bugzillaXMLFilePath}", "File not Errror", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void ApplySettings(IActivityMonitor m) { if (!_f.EnsureDirectory(m)) { return; } var solution = _solutionDriver.GetSolution(m, allowInvalidSolution: true); if (solution == null) { return; } var slnFile = solution.Tag <SolutionFile>(); MSProject ccbProject = slnFile.MSProjects.SingleOrDefault(p => p.ProjectName == "CodeCakeBuilder"); if (ccbProject == null) { m.Error($"Missing CodeCakeBuilder project in '{slnFile.FilePath}'."); return; } //slnFile.Save( m );//TODO }
public void TestDependsOn() { simpleProj = new MSProject("..\\UnitTests\\artifacts\\DataMapping_Text_1.xml"); simpleProj.LoadProjectFilePath = "..\\UnitTests\\artifacts\\MSProject_Test_0.mpp"; simpleProj.SaveProjectFilePath = "..\\UnitTests\\artifacts\\MSProject_Test_0.mpp"; simpleProj.InputPath = "..\\UnitTests\\artifacts\\two_bugs.xml"; simpleProj.InputType = InputDataFormat.BugzillaXML; simpleProj.LoadMPP(); simpleProj.Update(); foreach (Task task in simpleProj.Project.Tasks) { if (task.Number1 == 14963) { Console.WriteLine(task.Predecessors); Assert.IsTrue(task.Predecessors.Contains("6")); Assert.IsTrue(task.Predecessors.Contains("4")); Assert.IsTrue(task.Predecessors.Contains("3")); break; } } SimpleProjectClose(); simpleProj = null; }
void app_ProjectBeforeTaskNew(MSProject.Project pj, ref bool Cancel) { }
void app_ProjectBeforeTaskDelete(MSProject.Task tsk, ref bool Cancel) { }
void app_ProjectBeforeTaskChange(MSProject.Task tsk, MSProject.PjField Field, object NewVal, ref bool Cancel) { }
void app_ProjectBeforeClose(MSProject.Project pj, ref bool Cancel) { }
void app_NewProject(MSProject.Project pj) { }