Пример #1
0
        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");
        }
Пример #2
0
        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;
        }
Пример #3
0
        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;
        }
Пример #4
0
        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));
            }
        }
Пример #5
0
        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);
            }
        }
Пример #6
0
        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
        }
Пример #7
0
        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;
        }
Пример #8
0
 void app_ProjectBeforeTaskNew(MSProject.Project pj, ref bool Cancel)
 {
 }
Пример #9
0
 void app_ProjectBeforeTaskDelete(MSProject.Task tsk, ref bool Cancel)
 {
 }
Пример #10
0
 void app_ProjectBeforeTaskChange(MSProject.Task tsk, MSProject.PjField Field, object NewVal, ref bool Cancel)
 {
 }
Пример #11
0
 void app_ProjectBeforeClose(MSProject.Project pj, ref bool Cancel)
 {
 }
Пример #12
0
 void app_NewProject(MSProject.Project pj)
 {
 }