public void CreateProject(TemplateSelectionOptions templateOptions, ProjectDetails projectDetails, GitOptions gitOptions = null, object miscOptions = null) { PrintToTestRunner(templateOptions, projectDetails, gitOptions, miscOptions); ReproStep("Create a new project", templateOptions, projectDetails, gitOptions, miscOptions); var newProject = new NewProjectController(); if (projectDetails.AddProjectToExistingSolution) { newProject.Open(projectDetails.SolutionName); } else { newProject.Open(); } TakeScreenShot("Open"); OnSelectTemplate(newProject, templateOptions); OnEnterTemplateSpecificOptions(newProject, projectDetails.ProjectName, miscOptions); OnEnterProjectDetails(newProject, projectDetails, gitOptions, miscOptions); OnClickCreate(newProject, projectDetails); FoldersToClean.Add(projectDetails.SolutionLocation); }
void PrintToTestRunner(TemplateSelectionOptions templateOptions, ProjectDetails projectDetails, GitOptions gitOptions, object miscOptions) { templateOptions.PrintData(); projectDetails.PrintData(); gitOptions.PrintData(); miscOptions.PrintData(); }
public void CreateBuildProject(TemplateSelectionOptions templateOptions, Action beforeBuild, GitOptions gitOptions = null, object miscOptions = null) { var projectName = GenerateProjectName(templateOptions.TemplateKind); var projectDetails = new ProjectDetails { ProjectName = projectName, SolutionName = projectName, SolutionLocation = Util.CreateTmpDir(), ProjectInSolution = true }; CreateBuildProject(templateOptions, projectDetails, beforeBuild, gitOptions, miscOptions); }
public void CreateBuildProject(TemplateSelectionOptions templateOptions, ProjectDetails projectDetails, Action beforeBuild, GitOptions gitOptions = null, object miscOptions = null) { try { CreateProject(templateOptions, projectDetails, gitOptions, miscOptions); try { beforeBuild(); TakeScreenShot("BeforeBuild"); } catch (TimeoutException e) { TakeScreenShot("BeforeBuildActionFailed"); Assert.Fail(e.ToString()); } OnBuildTemplate((int)projectDetails.BuildTimeout.TotalSeconds); } catch (Exception e) { TakeScreenShot("TestFailedWithGenericException"); Assert.Fail(e.ToString()); } finally { FoldersToClean.Add(projectDetails.SolutionLocation); } }
protected virtual void OnEnterProjectDetails(NewProjectController newProject, ProjectDetails projectDetails, GitOptions gitOptions = null, object miscOptions = null) { if (!newProject.SetProjectName(projectDetails.ProjectName, projectDetails.AddProjectToExistingSolution)) { throw new CreateProjectException(string.Format("Failed at entering ProjectName as '{0}'", projectDetails.ProjectName)); } if (!string.IsNullOrEmpty(projectDetails.SolutionName)) { if (!newProject.SetSolutionName(projectDetails.SolutionName, projectDetails.AddProjectToExistingSolution)) { throw new CreateProjectException(string.Format("Failed at entering SolutionName as '{0}'", projectDetails.SolutionName)); } } if (!string.IsNullOrEmpty(projectDetails.SolutionLocation)) { if (!newProject.SetSolutionLocation(projectDetails.SolutionLocation)) { throw new CreateProjectException(string.Format("Failed at entering SolutionLocation as '{0}'", projectDetails.SolutionLocation)); } } if (!newProject.CreateProjectInSolutionDirectory(projectDetails.ProjectInSolution)) { throw new CreateProjectException(string.Format("Failed at entering ProjectInSolution as '{0}'", projectDetails.ProjectInSolution)); } if (gitOptions != null && !projectDetails.AddProjectToExistingSolution) { if (!newProject.UseGit(gitOptions)) { throw new CreateProjectException(string.Format("Failed at setting Git as - '{0}'", gitOptions)); } } TakeScreenShot("AfterProjectDetailsFilled"); }