Beispiel #1
0
            public static ProjectTypePerformanceMeasure Create()
            {
                var projectType        = TestProjectType.Create();
                var performanceMeasure = TestPerformanceMeasure.Create();

                return(Create(projectType, performanceMeasure));
            }
Beispiel #2
0
        public void CreateTestProject(string fullyQualifiedSolutionFileName, string projectName, TestProjectType testProjectType)
        {
            #region Argument Validation
            if (String.IsNullOrEmpty(fullyQualifiedSolutionFileName) || String.IsNullOrEmpty(fullyQualifiedSolutionFileName.Trim()))
            {
                throw new ArgumentNullException("fullyQualifiedSolutionFileName", "The solution file location is required.");
            }

            if (String.IsNullOrEmpty(projectName) || String.IsNullOrEmpty(projectName.Trim()))
            {
                throw new ArgumentNullException("projectName", "The project name is required.");
            }

            if (!System.IO.File.Exists(fullyQualifiedSolutionFileName))
            {
                throw new ArgumentException(String.Format("The file {0} specified does not exist.", fullyQualifiedSolutionFileName));
            }

            //if (testProjectType == null) testProjectType = TestProjectType.Unit;
            #endregion

            System.Type vsType = System.Type.GetTypeFromProgID("VisualStudio.DTE.10.0");
            Object vs = System.Activator.CreateInstance(vsType, true);

            EnvDTE80.DTE2 dte8Obj = (EnvDTE80.DTE2)vs;

            EnvDTE80.Solution2 vhaSolution = (EnvDTE80.Solution2)dte8Obj.Solution;
            //EnvDTE100.Solution4 vhaSolution = (EnvDTE100.Solution4)dte8Obj.Solution
            vhaSolution.Open(fullyQualifiedSolutionFileName);

            //TODO: Externalize company name
            string cmpnyName = "MCAF";
            string testProjectName = String.Format("{0}.{1}.{2}{3}", cmpnyName, projectName, testProjectType.ToString(), "Test");
            string testTemplateLocation = vhaSolution.GetProjectTemplate("TestProject.zip", "CSharp");
            System.IO.FileInfo rootSolutionFolder = new System.IO.FileInfo(fullyQualifiedSolutionFileName);

            //TODO: Externalize test directory name
            string testDirName = String.Format("{0}\\{1}\\{2}\\{3}", rootSolutionFolder.DirectoryName, "test", testProjectType.ToString(), testProjectName);

            if (!System.IO.Directory.Exists(testDirName))
            {
                //may throw an exception if the dir can't be created...
                System.IO.Directory.CreateDirectory(testDirName);
            }

            string csTemplatePath = vhaSolution.GetProjectTemplate("ConsoleApplication.zip", "CSharp");

            vhaSolution.AddFromTemplate(csTemplatePath, testDirName, testProjectName + ".proj", false);

            //EnvDTE.Project vhaTestProj = vhaSolution.AddFromTemplate(testTemplateLocation, testDirName, testProjectName + ".proj", false);
            //vhaTestProj.Save(String.Format("{0}\\{1}.proj", testDirName, testProjectName));
            vhaSolution.SaveAs(fullyQualifiedSolutionFileName);
        }
            public static Project Create()
            {
                var projectType  = TestProjectType.Create();
                var projectStage = ProjectStage.Planned;
                // TODO: Verify that "Approved" is the correct project state or use the correct value

                var testFocusArea = TestFocusArea.Create();
                var project       = Project.CreateNewBlank(projectType, projectStage, ProjectLocationSimpleType.None, ProjectApprovalStatus.Approved);

                project.FocusArea = testFocusArea;
                return(project);
            }
            public static Project Create(short projectID, string projectName)
            {
                var projectType  = TestProjectType.Create();
                var projectStage = ProjectStage.Implementation;
                var focusArea    = TestFocusArea.Create();

                // TODO: Verify that "Approved" is the correct project state or use the correct value
                var project = new Project(projectType, projectStage, projectName, false, ProjectLocationSimpleType.None, ProjectApprovalStatus.Approved, Project.CreateNewFhtProjectNumber())
                {
                    ProjectID = projectID
                };

                project.FocusArea          = focusArea;
                project.ProjectDescription = "Some description";
                return(project);
            }
            public static Project Create(DatabaseEntities dbContext)
            {
                var projectType  = TestProjectType.Create(dbContext);
                var projectStage = ProjectStage.Planned;
                var focusArea    = TestFocusArea.Create();

                var project = new Project(projectType,
                                          projectStage,
                                          $"Test Project Name {Guid.NewGuid()}",
                                          false,
                                          ProjectLocationSimpleType.None,
                                          // TODO: Verify that this is correct or use the correct value
                                          ProjectApprovalStatus.Approved,
                                          Project.CreateNewFhtProjectNumber()
                                          );

                project.FocusArea          = focusArea;
                project.ProjectDescription = MakeTestName("Test Project Description");
                dbContext.Projects.Add(project);
                return(project);
            }
Beispiel #6
0
        public void CreateTestProject(string fullyQualifiedSolutionFileName, string projectName, TestProjectType testProjectType)
        {
            #region Argument Validation
            if (String.IsNullOrEmpty(fullyQualifiedSolutionFileName) || String.IsNullOrEmpty(fullyQualifiedSolutionFileName.Trim()))
            {
                throw new ArgumentNullException("fullyQualifiedSolutionFileName", "The solution file location is required.");
            }

            if (String.IsNullOrEmpty(projectName) || String.IsNullOrEmpty(projectName.Trim()))
            {
                throw new ArgumentNullException("projectName", "The project name is required.");
            }

            if (!System.IO.File.Exists(fullyQualifiedSolutionFileName))
            {
                throw new ArgumentException(String.Format("The file {0} specified does not exist.", fullyQualifiedSolutionFileName));
            }

            //if (testProjectType == null) testProjectType = TestProjectType.Unit;
            #endregion

            System.Type vsType = System.Type.GetTypeFromProgID("VisualStudio.DTE.10.0");
            Object      vs     = System.Activator.CreateInstance(vsType, true);

            EnvDTE80.DTE2 dte8Obj = (EnvDTE80.DTE2)vs;

            EnvDTE80.Solution2 vhaSolution = (EnvDTE80.Solution2)dte8Obj.Solution;
            //EnvDTE100.Solution4 vhaSolution = (EnvDTE100.Solution4)dte8Obj.Solution
            vhaSolution.Open(fullyQualifiedSolutionFileName);

            //TODO: Externalize company name
            string             cmpnyName            = "MCAF";
            string             testProjectName      = String.Format("{0}.{1}.{2}{3}", cmpnyName, projectName, testProjectType.ToString(), "Test");
            string             testTemplateLocation = vhaSolution.GetProjectTemplate("TestProject.zip", "CSharp");
            System.IO.FileInfo rootSolutionFolder   = new System.IO.FileInfo(fullyQualifiedSolutionFileName);

            //TODO: Externalize test directory name
            string testDirName = String.Format("{0}\\{1}\\{2}\\{3}", rootSolutionFolder.DirectoryName, "test", testProjectType.ToString(), testProjectName);

            if (!System.IO.Directory.Exists(testDirName))
            {
                //may throw an exception if the dir can't be created...
                System.IO.Directory.CreateDirectory(testDirName);
            }

            string csTemplatePath = vhaSolution.GetProjectTemplate("ConsoleApplication.zip", "CSharp");

            vhaSolution.AddFromTemplate(csTemplatePath, testDirName, testProjectName + ".proj", false);

            //EnvDTE.Project vhaTestProj = vhaSolution.AddFromTemplate(testTemplateLocation, testDirName, testProjectName + ".proj", false);
            //vhaTestProj.Save(String.Format("{0}\\{1}.proj", testDirName, testProjectName));
            vhaSolution.SaveAs(fullyQualifiedSolutionFileName);
        }