public void CreateProject(TemplateSelectionOptions templateOptions, ProjectDetails projectDetails, GitOptions gitOptions = null, object miscOptions = null) { 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); }
public void DontShowPackageUpdatesAvailable () { var templateOptions = new TemplateSelectionOptions { CategoryRoot = OtherCategoryRoot, Category = ".NET", TemplateKindRoot = GeneralKindRoot, TemplateKind = "Console Project" }; var projectDetails = new ProjectDetails (templateOptions); CreateProject (templateOptions, projectDetails); NuGetController.AddPackage (new NuGetPackageOptions { PackageName = "CommandLineParser", Version = "1.9.3.34", IsPreRelease = false }, TakeScreenShot); string solutionFolder = GetSolutionDirectory (); string solutionPath = Path.Combine (solutionFolder, projectDetails.SolutionName+".sln"); var projectPath = Path.Combine (solutionFolder, projectDetails.ProjectName, projectDetails.ProjectName + ".csproj"); Assert.IsTrue (File.Exists (projectPath)); TakeScreenShot ("About-To-Close-Solution"); Session.ExecuteCommand (FileCommands.CloseWorkspace); TakeScreenShot ("Closed-Solution"); Session.GlobalInvoke ("MonoDevelop.Ide.IdeApp.Workspace.OpenWorkspaceItem", new FilePath (solutionPath), true); TakeScreenShot ("Solution-Opened"); Assert.Throws <TimeoutException> (() => Ide.WaitForPackageUpdate ()); Ide.WaitForSolutionLoaded (); TakeScreenShot ("Solution-Ready"); }
void PrintToTestRunner(TemplateSelectionOptions templateOptions, ProjectDetails projectDetails, GitOptions gitOptions, object miscOptions) { templateOptions.PrintData(); projectDetails.PrintData(); gitOptions.PrintData(); miscOptions.PrintData(); }
protected virtual void OnClickCreate(NewProjectController newProject, ProjectDetails projectDetails) { if (projectDetails.AddProjectToExistingSolution) { newProject.Create(); } else { Session.RunAndWaitForTimer(() => newProject.Create(), "Ide.Shell.SolutionOpened"); } }
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, 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); }
void TestFolderPreview(GitOptions gitOptions, bool projectWithinSolution) { var projectDetails = new ProjectDetails { ProjectName = projectName, SolutionName = solutionName, SolutionLocation = solutionLocation, ProjectInSolution = projectWithinSolution }; ctrl.Open(); OnSelectTemplate(ctrl, templateOptions); OnEnterProjectDetails(ctrl, projectDetails, gitOptions); ctrl.ValidatePreviewTree(projectDetails, gitOptions); ctrl.Close(); }
void TestFolderPreview (GitOptions gitOptions, bool projectWithinSolution) { var projectDetails = new ProjectDetails { ProjectName = projectName, SolutionName = solutionName, SolutionLocation = solutionLocation, ProjectInSolution = projectWithinSolution }; ctrl.Open (); OnSelectTemplate (ctrl, templateOptions); OnEnterProjectDetails (ctrl, projectDetails, gitOptions); ctrl.ValidatePreviewTree (projectDetails, gitOptions); ctrl.Close (); }
public void CreateProject(TemplateSelectionOptions templateOptions, ProjectDetails projectDetails, GitOptions gitOptions = null, object miscOptions = null) { var newProject = new NewProjectController(); newProject.Open(); TakeScreenShot("Open"); OnSelectTemplate(newProject, templateOptions); OnEnterTemplateSpecificOptions(newProject, projectDetails.ProjectName, miscOptions); OnEnterProjectDetails(newProject, projectDetails, gitOptions, miscOptions); OnClickCreate(newProject); }
ProjectDetails CreateProject () { var templateOptions = new TemplateSelectionOptions { CategoryRoot = OtherCategoryRoot, Category = ".NET", TemplateKindRoot = GeneralKindRoot, TemplateKind = "Console Project" }; var projectDetails = new ProjectDetails (templateOptions); CreateProject (templateOptions, projectDetails, new GitOptions { UseGit = true, UseGitIgnore = true}); Session.WaitForElement (IdeQuery.TextArea); FoldersToClean.Add (projectDetails.SolutionLocation); return projectDetails; }
public void ValidatePreviewTree(ProjectDetails projectDetails, GitOptions gitOptions) { var rootFolder = projectDetails.ProjectInSolution ? projectDetails.SolutionName : projectDetails.ProjectName; Func <AppQuery, AppQuery> solutionLocation = (c) => previewTree(c).Contains(projectDetails.SolutionLocation); Func <AppQuery, AppQuery> solutionLocationChildren = (c) => solutionLocation(c).Children(); Func <AppQuery, AppQuery> rootFolderChildren = (c) => solutionLocationChildren(c).Contains(rootFolder).Children(); Func <AppQuery, AppQuery> checkForGit = c => rootFolderChildren(c).Index(0).Contains("<span color='#AAAAAA'>.git</span>"); Func <AppQuery, AppQuery> checkForGitIgnore = c => rootFolderChildren(c).Index(1).Contains("<span color='#AAAAAA'>.gitignore</span>"); Assert.IsNotEmpty(Session.Query(c => solutionLocation(c))); Assert.IsNotEmpty(Session.Query(c => solutionLocation(c).Children().Contains(rootFolder))); if (gitOptions.UseGit) { Assert.IsNotEmpty(Session.Query(checkForGit)); if (gitOptions.UseGitIgnore) { Assert.IsNotEmpty(Session.Query(checkForGitIgnore)); } else { Assert.IsEmpty(Session.Query(checkForGitIgnore)); } } else { Assert.IsEmpty(Session.Query(checkForGit)); Assert.IsEmpty(Session.Query(checkForGitIgnore)); } Assert.IsNotEmpty(Session.Query(c => rootFolderChildren(c).Contains(projectDetails.SolutionName + ".sln"))); if (projectDetails.ProjectInSolution) { Assert.IsNotEmpty(Session.Query(c => rootFolderChildren(c).Contains(projectDetails.ProjectName))); Assert.IsNotEmpty(Session.Query(c => rootFolderChildren(c).Contains(projectDetails.ProjectName).Children().Contains(projectDetails.ProjectName + ".csproj"))); } else { Assert.IsNotEmpty(Session.Query(c => rootFolderChildren(c).Contains(projectDetails.ProjectName + ".csproj"))); } }
ProjectDetails CreateProject() { var templateOptions = new TemplateSelectionOptions { CategoryRoot = OtherCategoryRoot, Category = ".NET", TemplateKindRoot = GeneralKindRoot, TemplateKind = "Console Project" }; var projectDetails = new ProjectDetails(templateOptions); CreateProject(templateOptions, projectDetails, new GitOptions { UseGit = true, UseGitIgnore = true }); Session.WaitForElement(IdeQuery.TextArea); FoldersToClean.Add(projectDetails.SolutionLocation); return(projectDetails); }
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); } }
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); } }
public void DontShowPackageUpdatesAvailable() { var templateOptions = new TemplateSelectionOptions { CategoryRoot = OtherCategoryRoot, Category = ".NET", TemplateKindRoot = GeneralKindRoot, TemplateKind = "Console Project" }; var projectDetails = new ProjectDetails(templateOptions); CreateProject(templateOptions, projectDetails); NuGetController.AddPackage(new NuGetPackageOptions { PackageName = "CommandLineParser", Version = "1.9.3.34", IsPreRelease = false }, this); string solutionFolder = GetSolutionDirectory(); string solutionPath = Path.Combine(solutionFolder, projectDetails.SolutionName + ".sln"); var projectPath = Path.Combine(solutionFolder, projectDetails.ProjectName, projectDetails.ProjectName + ".csproj"); Assert.IsTrue(File.Exists(projectPath)); Workbench.CloseWorkspace(this); Workbench.OpenWorkspace(solutionPath, this); try { const string expected = "When a solution is opened and package updates are available, it don't show in status bar"; ReproStep(expected); Ide.WaitForPackageUpdate(); var failureMessage = string.Format("Expected: {0}\nActual: {1}", expected, "When a solution is opened and package updates are available, it shows in status bar"); ReproStep(failureMessage); Assert.Fail(failureMessage); } catch (TimeoutException) { Session.DebugObject.Debug("WaitForPackageUpdate throws TimeoutException as expected"); } Ide.WaitForSolutionLoaded(); TakeScreenShot("Solution-Ready"); }
public void DontShowPackageUpdatesAvailable () { var templateOptions = new TemplateSelectionOptions { CategoryRoot = OtherCategoryRoot, Category = ".NET", TemplateKindRoot = GeneralKindRoot, TemplateKind = "Console Project" }; var projectDetails = new ProjectDetails (templateOptions); CreateProject (templateOptions, projectDetails); NuGetController.AddPackage (new NuGetPackageOptions { PackageName = "CommandLineParser", Version = "1.9.3.34", IsPreRelease = false }, this); string solutionFolder = GetSolutionDirectory (); string solutionPath = Path.Combine (solutionFolder, projectDetails.SolutionName+".sln"); var projectPath = Path.Combine (solutionFolder, projectDetails.ProjectName, projectDetails.ProjectName + ".csproj"); Assert.IsTrue (File.Exists (projectPath)); Workbench.CloseWorkspace (this); Workbench.OpenWorkspace (solutionPath, this); try { const string expected = "When a solution is opened and package updates are available, it don't show in status bar"; ReproStep (expected); Ide.WaitForPackageUpdate (); var failureMessage = string.Format ("Expected: {0}\nActual: {1}", expected, "When a solution is opened and package updates are available, it shows in status bar"); ReproStep (failureMessage); Assert.Fail (failureMessage); } catch (TimeoutException) { Session.DebugObject.Debug ("WaitForPackageUpdate throws TimeoutException as expected"); } Ide.WaitForSolutionLoaded (); TakeScreenShot ("Solution-Ready"); }
public void TestLocalCopyPreservedUpdate() { var templateOptions = new TemplateSelectionOptions { CategoryRoot = OtherCategoryRoot, Category = ".NET", TemplateKindRoot = GeneralKindRoot, TemplateKind = "Console Project" }; var projectDetails = new ProjectDetails(templateOptions); CreateProject(templateOptions, projectDetails); NuGetController.AddPackage(new NuGetPackageOptions { PackageName = "CommandLineParser", Version = "1.9.7", IsPreRelease = false }, TakeScreenShot); string solutionFolder = GetSolutionDirectory(); string solutionPath = Path.Combine(solutionFolder, projectDetails.SolutionName + ".sln"); var projectPath = Path.Combine(solutionFolder, projectDetails.ProjectName, projectDetails.ProjectName + ".csproj"); Assert.IsTrue(File.Exists(projectPath)); TakeScreenShot("About-To-Close-Solution"); Session.ExecuteCommand(FileCommands.CloseWorkspace); TakeScreenShot("Closed-Solution"); AddOrCheckLocalCopy(projectPath, true); Session.GlobalInvoke("MonoDevelop.Ide.IdeApp.Workspace.OpenWorkspaceItem", new FilePath(solutionPath), true); TakeScreenShot("Solution-Opened"); Ide.WaitForPackageUpdate(); TakeScreenShot("Solution-Ready"); NuGetController.UpdateAllNuGetPackages(TakeScreenShot); AddOrCheckLocalCopy(projectPath, false); }
public void TestDontOpenReadmeOpenedInOther() { var packageInfo = new NuGetPackageOptions { PackageName = "RestSharp", Version = "105.2.3", IsPreRelease = true }; var projectDetails = CreateProject(); NuGetController.AddPackage(packageInfo, this); WaitForNuGetReadmeOpened(); Session.ExecuteCommand(FileCommands.CloseFile); var pclTemplateOptions = new TemplateSelectionOptions { CategoryRoot = "Other", Category = ".NET", TemplateKindRoot = "General", TemplateKind = "Library" }; var pclProjectDetails = ProjectDetails.ToExistingSolution(projectDetails.SolutionName, GenerateProjectName(pclTemplateOptions.TemplateKind)); CreateProject(pclTemplateOptions, pclProjectDetails); Ide.WaitForIdeIdle(30); SolutionExplorerController.SelectProject(projectDetails.SolutionName, pclProjectDetails.ProjectName); NuGetController.AddPackage(packageInfo, this); try { WaitForNuGetReadmeOpened(false); var failureMessage = string.Format("Expected: {0}\nActual:{1}", "readme.txt tab should not open", "readme.txt tab opens"); ReproStep(failureMessage); Assert.Fail(failureMessage); } catch (TimeoutException) { Session.DebugObject.Debug("readme.txt tab failed to open as expected"); } }
public void TestLocalCopyPreservedUpdate() { var templateOptions = new TemplateSelectionOptions { CategoryRoot = OtherCategoryRoot, Category = ".NET", TemplateKindRoot = GeneralKindRoot, TemplateKind = "Console Project" }; var projectDetails = new ProjectDetails(templateOptions); CreateProject(templateOptions, projectDetails); NuGetController.AddPackage(new NuGetPackageOptions { PackageName = "CommandLineParser", Version = "1.9.71", IsPreRelease = false }, this); string solutionFolder = GetSolutionDirectory(); string solutionPath = Path.Combine(solutionFolder, projectDetails.SolutionName + ".sln"); var projectPath = Path.Combine(solutionFolder, projectDetails.ProjectName, projectDetails.ProjectName + ".csproj"); Assert.IsTrue(File.Exists(projectPath)); ReproStep("Check 'Local Copy' on CommandLine package under References"); Workbench.CloseWorkspace(this); AddOrCheckLocalCopy(projectPath, true); Workbench.OpenWorkspace(solutionPath, this); NuGetController.UpdateAllNuGetPackages(this); ReproStep("Check if CommandLine package under References has 'Local Copy' checked"); AddOrCheckLocalCopy(projectPath, false); }
public void TestLocalCopyPreservedUpdate () { var templateOptions = new TemplateSelectionOptions { CategoryRoot = OtherCategoryRoot, Category = ".NET", TemplateKindRoot = GeneralKindRoot, TemplateKind = "Console Project" }; var projectDetails = new ProjectDetails (templateOptions); CreateProject (templateOptions, projectDetails); NuGetController.AddPackage (new NuGetPackageOptions { PackageName = "CommandLineParser", Version = "1.9.71", IsPreRelease = false }, this); string solutionFolder = GetSolutionDirectory (); string solutionPath = Path.Combine (solutionFolder, projectDetails.SolutionName+".sln"); var projectPath = Path.Combine (solutionFolder, projectDetails.ProjectName, projectDetails.ProjectName + ".csproj"); Assert.IsTrue (File.Exists (projectPath)); ReproStep ("Check 'Local Copy' on CommandLine package under References"); Workbench.CloseWorkspace (this); AddOrCheckLocalCopy (projectPath, true); Workbench.OpenWorkspace (solutionPath, this); NuGetController.UpdateAllNuGetPackages (this); ReproStep ("Check if CommandLine package under References has 'Local Copy' checked"); AddOrCheckLocalCopy (projectPath, false); }
public void TestLocalCopyPreservedUpdate () { var templateOptions = new TemplateSelectionOptions { CategoryRoot = OtherCategoryRoot, Category = ".NET", TemplateKindRoot = GeneralKindRoot, TemplateKind = "Console Project" }; var projectDetails = new ProjectDetails (templateOptions); CreateProject (templateOptions, projectDetails); NuGetController.AddPackage (new NuGetPackageOptions { PackageName = "CommandLineParser", Version = "1.9.7", IsPreRelease = false }, TakeScreenShot); string solutionFolder = GetSolutionDirectory (); string solutionPath = Path.Combine (solutionFolder, projectDetails.SolutionName+".sln"); var projectPath = Path.Combine (solutionFolder, projectDetails.ProjectName, projectDetails.ProjectName + ".csproj"); Assert.IsTrue (File.Exists (projectPath)); TakeScreenShot ("About-To-Close-Solution"); Session.ExecuteCommand (FileCommands.CloseWorkspace); TakeScreenShot ("Closed-Solution"); AddOrCheckLocalCopy (projectPath, true); Session.GlobalInvoke ("MonoDevelop.Ide.IdeApp.Workspace.OpenWorkspaceItem", new FilePath (solutionPath), true); TakeScreenShot ("Solution-Opened"); Ide.WaitForPackageUpdateExtra (new List<string> { "Solution loaded." }); TakeScreenShot ("Solution-Ready"); NuGetController.UpdateAllNuGetPackages (TakeScreenShot); AddOrCheckLocalCopy (projectPath, false); }
protected virtual void OnEnterProjectDetails(NewProjectController newProject, ProjectDetails projectDetails, GitOptions gitOptions = null, object miscOptions = null) { Assert.IsTrue(newProject.SetProjectName(projectDetails.ProjectName)); if (!string.IsNullOrEmpty(projectDetails.SolutionName)) { Assert.IsTrue(newProject.SetSolutionName(projectDetails.SolutionName)); } if (!string.IsNullOrEmpty(projectDetails.SolutionLocation)) { Assert.IsTrue(newProject.SetSolutionLocation(projectDetails.SolutionLocation)); } Assert.IsTrue(newProject.CreateProjectInSolutionDirectory(projectDetails.ProjectInSolution)); if (gitOptions != null) { Assert.IsTrue(newProject.UseGit(gitOptions)); } TakeScreenShot("AfterProjectDetailsFilled"); }
protected virtual void OnEnterProjectDetails (NewProjectController newProject, ProjectDetails projectDetails, GitOptions gitOptions = null, object miscOptions = null) { Assert.IsTrue (newProject.SetProjectName (projectDetails.ProjectName)); if (!string.IsNullOrEmpty (projectDetails.SolutionName)) { Assert.IsTrue (newProject.SetSolutionName (projectDetails.SolutionName)); } if (!string.IsNullOrEmpty (projectDetails.SolutionLocation)) { Assert.IsTrue (newProject.SetSolutionLocation (projectDetails.SolutionLocation)); } Assert.IsTrue (newProject.CreateProjectInSolutionDirectory (projectDetails.ProjectInSolution)); if (gitOptions != null) Assert.IsTrue (newProject.UseGit (gitOptions)); TakeScreenShot ("AfterProjectDetailsFilled"); }
void PrintToTestRunner (TemplateSelectionOptions templateOptions, ProjectDetails projectDetails, GitOptions gitOptions, object miscOptions) { templateOptions.PrintData (); projectDetails.PrintData (); gitOptions.PrintData (); miscOptions.PrintData (); }
protected virtual void OnClickCreate (NewProjectController newProject, ProjectDetails projectDetails) { if (projectDetails.AddProjectToExistingSolution) newProject.Create (); else Session.RunAndWaitForTimer (() => newProject.Create (), "Ide.Shell.SolutionOpened"); }
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"); }
public void CreateProject (TemplateSelectionOptions templateOptions, ProjectDetails projectDetails, GitOptions gitOptions = null, object miscOptions = null) { PrintToTestRunner (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); }
public void CreateProject (TemplateSelectionOptions templateOptions, ProjectDetails projectDetails, GitOptions gitOptions = null, object miscOptions = null) { var newProject = new NewProjectController (); newProject.Open (); TakeScreenShot ("Open"); OnSelectTemplate (newProject, templateOptions); OnEnterTemplateSpecificOptions (newProject, projectDetails.ProjectName, miscOptions); OnEnterProjectDetails (newProject, projectDetails, gitOptions, miscOptions); OnClickCreate (newProject); }
protected virtual void OnEnterProjectDetails(NewProjectController newProject, ProjectDetails projectDetails, GitOptions gitOptions = null, object miscOptions = null) { if (!newProject.SetProjectName(projectDetails.ProjectName)) { 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"); }
public void ValidatePreviewTree (ProjectDetails projectDetails, GitOptions gitOptions) { var rootFolder = projectDetails.ProjectInSolution ? projectDetails.SolutionName : projectDetails.ProjectName; Func<AppQuery, AppQuery> solutionLocation = (c) => previewTree (c).Contains (projectDetails.SolutionLocation); Func<AppQuery, AppQuery> solutionLocationChildren = (c) => solutionLocation (c).Children (); Func<AppQuery, AppQuery> rootFolderChildren = (c) => solutionLocationChildren (c).Contains (rootFolder).Children (); Func<AppQuery, AppQuery> checkForGit = c => rootFolderChildren (c).Index (0).Contains ("<span color='#AAAAAA'>.git</span>"); Func<AppQuery, AppQuery> checkForGitIgnore = c => rootFolderChildren (c).Index (1).Contains ("<span color='#AAAAAA'>.gitignore</span>"); Assert.IsNotEmpty (Session.Query (c => solutionLocation (c))); Assert.IsNotEmpty (Session.Query (c => solutionLocation (c).Children ().Contains (rootFolder))); if (gitOptions.UseGit) { Assert.IsNotEmpty (Session.Query (checkForGit)); if (gitOptions.UseGitIgnore) Assert.IsNotEmpty (Session.Query (checkForGitIgnore)); else Assert.IsEmpty (Session.Query (checkForGitIgnore)); } else { Assert.IsEmpty (Session.Query (checkForGit)); Assert.IsEmpty (Session.Query (checkForGitIgnore)); } Assert.IsNotEmpty (Session.Query (c => rootFolderChildren (c).Contains (projectDetails.SolutionName + ".sln"))); if (projectDetails.ProjectInSolution) { Assert.IsNotEmpty (Session.Query (c => rootFolderChildren (c).Contains (projectDetails.ProjectName))); Assert.IsNotEmpty (Session.Query (c => rootFolderChildren (c).Contains (projectDetails.ProjectName).Children ().Contains (projectDetails.ProjectName + ".csproj"))); } else { Assert.IsNotEmpty (Session.Query (c => rootFolderChildren (c).Contains (projectDetails.ProjectName + ".csproj"))); } }