示例#1
0
        public void TestStashAndUnstashSuccessful()
        {
            var templateOptions = new TemplateSelectionOptions {
                CategoryRoot     = OtherCategoryRoot,
                Category         = ".NET",
                TemplateKindRoot = GeneralKindRoot,
                TemplateKind     = "Console Project"
            };

            CreateProject(templateOptions,
                          new ProjectDetails(templateOptions),
                          new GitOptions {
                UseGit = true, UseGitIgnore = true
            });

            Session.WaitForElement(IdeQuery.TextArea);
            TestCommit("First commit");

            Session.ExecuteCommand(FileCommands.CloseFile);
            Session.WaitForElement(IdeQuery.TextArea);

            Session.ExecuteCommand(TextEditorCommands.InsertNewLine);
            TakeScreenShot("Inserted-Newline-Marked-Dirty");
            Session.ExecuteCommand(FileCommands.SaveAll);
            TakeScreenShot("Inserted-Newline-SaveAll-Called");

            TestGitStash("Entered new blank line");

            Session.WaitForElement(IdeQuery.TextArea);
            TakeScreenShot("After-Stash");

            TestGitUnstash();
            TakeScreenShot("Untash-Successful");
        }
        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");
		}
示例#4
0
 void PrintToTestRunner(TemplateSelectionOptions templateOptions,
                        ProjectDetails projectDetails, GitOptions gitOptions, object miscOptions)
 {
     templateOptions.PrintData();
     projectDetails.PrintData();
     gitOptions.PrintData();
     miscOptions.PrintData();
 }
示例#5
0
 protected virtual void OnSelectTemplate(NewProjectController newProject, TemplateSelectionOptions templateOptions)
 {
     Assert.IsTrue(newProject.SelectTemplateType(templateOptions.CategoryRoot, templateOptions.Category));
     TakeScreenShot("TemplateCategorySelected");
     Assert.IsTrue(newProject.SelectTemplate(templateOptions.TemplateKindRoot, templateOptions.TemplateKind));
     TakeScreenShot("TemplateSelected");
     Assert.IsTrue(newProject.Next());
     TakeScreenShot("NextAfterTemplateSelected");
 }
示例#6
0
		public void TestCommit ()
		{
			var templateOptions = new TemplateSelectionOptions {
				CategoryRoot = OtherCategoryRoot,
				Category = ".NET",
				TemplateKindRoot = GeneralKindRoot,
				TemplateKind = "Console Project"
			};
			GitCreateAndCommit (templateOptions, "First commit");
		}
示例#7
0
		public void RunMiscTemplatesTest (string templateName, string templateKind)
		{
			var templateOptions = new TemplateSelectionOptions {
				CategoryRoot = OtherCategoryRoot,
				Category = miscCategory,
				TemplateKindRoot = templateKind,
				TemplateKind = templateName
			};
			CreateBuildProject (templateOptions, EmptyAction);
		}
		public void RunDotNetTests (string templateName, int totalTimeoutInSecs)
		{
			var templateOptions = new TemplateSelectionOptions {
				CategoryRoot = OtherCategoryRoot,
				Category = dotNetCategory,
				TemplateKindRoot = GeneralKindRoot,
				TemplateKind = templateName
			};
			CreateBuildProject (templateOptions, () => Ide.WaitForIdeIdle ((uint)totalTimeoutInSecs));
		}
		public void RunASPTest (string templateName, BeforeBuildAction beforeBuild)
		{
			var templateOptions = new TemplateSelectionOptions {
				CategoryRoot = OtherCategoryRoot,
				Category = aspCategory,
				TemplateKindRoot = GeneralKindRoot,
				TemplateKind = templateName
			};
			CreateBuildProject (templateOptions, beforeBuild.GetAction ());
		}
        public void RunDotNetTests(string templateName, BeforeBuildAction beforeBuild)
        {
            var templateOptions = new TemplateSelectionOptions {
                CategoryRoot     = OtherCategoryRoot,
                Category         = dotNetCategory,
                TemplateKindRoot = GeneralKindRoot,
                TemplateKind     = templateName
            };

            CreateBuildProject(templateOptions, beforeBuild.GetAction());
        }
		public void RunMiscTemplatesTest (string templateName, string templateKind)
		{
			var templateOptions = new TemplateSelectionOptions {
				CategoryRoot = OtherCategoryRoot,
				Category = miscCategory,
				TemplateKindRoot = templateKind,
				TemplateKind = templateName
			};
			CreateBuildProject (templateOptions, () => Ide.WaitForIdeIdle ());
			IsTemplateSelected (templateOptions);
		}
示例#12
0
        protected void GitCreateAndCommit(TemplateSelectionOptions templateOptions, string commitMessage)
        {
            CreateProject(templateOptions,
                          new ProjectDetails(templateOptions),
                          new GitOptions {
                UseGit = true, UseGitIgnore = true
            });

            Session.WaitForElement(IdeQuery.TextArea);
            TestCommit(commitMessage);
        }
        public void RunMiscTemplatesTest(string templateName, string templateKind)
        {
            var templateOptions = new TemplateSelectionOptions {
                CategoryRoot     = OtherCategoryRoot,
                Category         = miscCategory,
                TemplateKindRoot = templateKind,
                TemplateKind     = templateName
            };

            CreateBuildProject(templateOptions, EmptyAction);
        }
		public void RunASPTest (string templateName)
		{
			var templateOptions = new TemplateSelectionOptions {
				CategoryRoot = OtherCategoryRoot,
				Category = aspCategory,
				TemplateKindRoot = GeneralKindRoot,
				TemplateKind = templateName
			};

			CreateBuildProject (templateOptions, () => Ide.WaitForIdeIdle (totalTimeoutInSecs: 50));
		}
示例#15
0
        public void RunASPTest(string templateName)
        {
            var templateOptions = new TemplateSelectionOptions {
                CategoryRoot     = OtherCategoryRoot,
                Category         = aspCategory,
                TemplateKindRoot = GeneralKindRoot,
                TemplateKind     = templateName
            };

            CreateBuildProject(templateOptions, () => Ide.WaitForIdeIdle(totalTimeoutInSecs: 50));
        }
示例#16
0
        public void RunDotNetTests(string templateName, int totalTimeoutInSecs)
        {
            var templateOptions = new TemplateSelectionOptions {
                CategoryRoot     = OtherCategoryRoot,
                Category         = dotNetCategory,
                TemplateKindRoot = GeneralKindRoot,
                TemplateKind     = templateName
            };

            CreateBuildProject(templateOptions, () => Ide.WaitForIdeIdle((uint)totalTimeoutInSecs));
        }
示例#17
0
        public void RunMiscTemplatesTest(string templateName, string templateKind)
        {
            var templateOptions = new TemplateSelectionOptions {
                CategoryRoot     = OtherCategoryRoot,
                Category         = miscCategory,
                TemplateKindRoot = templateKind,
                TemplateKind     = templateName
            };

            CreateBuildProject(templateOptions, () => Ide.WaitForIdeIdle());
            IsTemplateSelected(templateOptions);
        }
		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);
        }
示例#20
0
        protected void IsTemplateSelected(TemplateSelectionOptions templateOptions, string addToExistingSolution = null)
        {
//			var newProject = new NewProjectController ();
//			try {
//				newProject.WaitForOpen ();
//			} catch (TimeoutException) {
//				if (!string.IsNullOrEmpty (addToExistingSolution))
//					newProject.Open (addToExistingSolution);
//				else
//					newProject.Open ();
//			}
//			newProject.IsSelected (templateOptions);
        }
示例#21
0
		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;
		}
示例#22
0
        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);
        }
示例#23
0
        void CreateProjectAndCommitAndStash()
        {
            var templateOptions = new TemplateSelectionOptions {
                CategoryRoot     = OtherCategoryRoot,
                Category         = ".NET",
                TemplateKindRoot = GeneralKindRoot,
                TemplateKind     = "Console Project"
            };

            GitCreateAndCommit(templateOptions, "First commit");
            var changeDescription = MakeSomeChangesAndSaveAll("Program.cs");

            TestGitStash(changeDescription);
            Session.WaitForElement(IdeQuery.TextArea, 20000);
            TakeScreenShot("After-Stash");
        }
示例#24
0
		public void TestStashWithoutHeadCommit ()
		{
			var templateOptions = new TemplateSelectionOptions {
				CategoryRoot = OtherCategoryRoot,
				Category = ".NET",
				TemplateKindRoot = GeneralKindRoot,
				TemplateKind = "Console Project"
			};
			CreateProject (templateOptions,
				new ProjectDetails (templateOptions),
				new GitOptions { UseGit = true, UseGitIgnore = true});
			
			Session.WaitForElement (IdeQuery.TextArea);
			Assert.Throws <TimeoutException> (() => TestGitStash ("Stash without head commit"));
			TakeScreenShot ("Stash-Window-Doesnt-Show");
		}
示例#25
0
        public void TestCommit()
        {
            var templateOptions = new TemplateSelectionOptions {
                CategoryRoot     = OtherCategoryRoot,
                Category         = ".NET",
                TemplateKindRoot = GeneralKindRoot,
                TemplateKind     = "Console Project"
            };

            CreateProject(templateOptions,
                          new ProjectDetails(templateOptions),
                          new GitOptions {
                UseGit = true, UseGitIgnore = true
            });

            Session.WaitForElement(IdeQuery.TextArea);
            TestCommit("First commit");
        }
示例#26
0
 ProjectDetails CreateProject(TemplateSelectionOptions templateOptions = null, ProjectDetails projectDetails = null)
 {
     templateOptions = templateOptions ?? new TemplateSelectionOptions {
         CategoryRoot     = OtherCategoryRoot,
         Category         = ".NET",
         TemplateKindRoot = GeneralKindRoot,
         TemplateKind     = "Console Project"
     };
     projectDetails = projectDetails ?? new ProjectDetails(templateOptions);
     CreateProject(templateOptions,
                   projectDetails,
                   new GitOptions {
         UseGit = true, UseGitIgnore = true
     });
     Session.WaitForElement(IdeQuery.TextArea);
     FoldersToClean.Add(projectDetails.SolutionLocation);
     return(projectDetails);
 }
示例#27
0
		public void TestNoChangesStashOperation ()
		{
			var templateOptions = new TemplateSelectionOptions {
				CategoryRoot = OtherCategoryRoot,
				Category = ".NET",
				TemplateKindRoot = GeneralKindRoot,
				TemplateKind = "Console Project"
			};
			CreateProject (templateOptions,
				new ProjectDetails (templateOptions),
				new GitOptions { UseGit = true, UseGitIgnore = true});
			
			Session.WaitForElement (IdeQuery.TextArea);
			TestCommit ("First commit");
			Session.ExecuteCommand (FileCommands.CloseAllFiles);
			Assert.Throws <TimeoutException> (() => TestGitStash ("No changes stash attempt"));
			Ide.WaitForStatusMessage (new [] {"No changes were available to stash"}, 20);
		}
		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);
			}
		}
示例#29
0
        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);
            }
        }
示例#30
0
        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");
        }
        protected virtual void OnSelectTemplate(NewProjectController newProject, TemplateSelectionOptions templateOptions)
        {
            if (!newProject.SelectTemplateType(templateOptions.CategoryRoot, templateOptions.Category))
            {
                throw new TemplateSelectionException(string.Format("Failed to select Category '{0}' under '{1}'",
                                                                   templateOptions.Category, templateOptions.CategoryRoot));
            }
            TakeScreenShot("TemplateCategorySelected");

            if (!newProject.SelectTemplate(templateOptions.TemplateKindRoot, templateOptions.TemplateKind))
            {
                throw new TemplateSelectionException(string.Format("Failed to select Template '{0}' under '{1}'",
                                                                   templateOptions.TemplateKind, templateOptions.TemplateKindRoot));
            }
            TakeScreenShot("TemplateSelected");

            if (!newProject.Next())
            {
                throw new TemplateSelectionException("Clicking Next failed after selecting template");
            }
            TakeScreenShot("NextAfterTemplateSelected");
        }
示例#32
0
        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);
        }
示例#33
0
        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 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");
		}
示例#35
0
        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);
        }
示例#36
0
		public void TestDontOpenReadmeOpenedInOther ()
		{
			var packageInfo = new NuGetPackageOptions {
				PackageName = "RestSharp",
				Version = "105.0.1",
				IsPreRelease = true
			};

			var projectDetails = CreateProject ();
			NuGetController.AddPackage (packageInfo, TakeScreenShot);
			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);

			SolutionExplorerController.SelectProject (projectDetails.SolutionName, pclProjectDetails.ProjectName);
			NuGetController.AddPackage (packageInfo, TakeScreenShot);
			Assert.Throws<TimeoutException> (WaitForNuGetReadmeOpened);
		}
示例#37
0
		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);
		}
		public bool IsSelected  (TemplateSelectionOptions templateOptions)
		{
			return Session.SelectElement (templateCategoriesQuery) && IsTemplateTypeSelected (templateOptions.CategoryRoot, templateOptions.Category)
				&& Session.SelectElement (templatesQuery) && IsTemplateSelected (templateOptions.TemplateKindRoot, templateOptions.TemplateKind);
		}
		protected virtual void OnSelectTemplate (NewProjectController newProject, TemplateSelectionOptions templateOptions)
		{
			Assert.IsTrue (newProject.SelectTemplateType (templateOptions.CategoryRoot, templateOptions.Category));
			TakeScreenShot ("TemplateCategorySelected");
			Assert.IsTrue (newProject.SelectTemplate (templateOptions.TemplateKindRoot, templateOptions.TemplateKind));
			TakeScreenShot ("TemplateSelected");
			Assert.IsTrue (newProject.Next ());
			TakeScreenShot ("NextAfterTemplateSelected");
		}
示例#40
0
 public ProjectDetails(TemplateSelectionOptions templateData) : this()
 {
     ProjectName  = CreateBuildTemplatesTestBase.GenerateProjectName(templateData.TemplateKind);
     SolutionName = ProjectName;
 }
		public ProjectDetails (TemplateSelectionOptions templateData) : this ()
		{
			ProjectName = CreateBuildTemplatesTestBase.GenerateProjectName (templateData.TemplateKind);
			SolutionName = ProjectName;
			BuildTimeout = TimeSpan.FromSeconds (180);
		}
		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 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);
		}
		void PrintToTestRunner (TemplateSelectionOptions templateOptions,
			ProjectDetails projectDetails, GitOptions gitOptions, object miscOptions)
		{
			templateOptions.PrintData ();
			projectDetails.PrintData ();
			gitOptions.PrintData ();
			miscOptions.PrintData ();
		}
		protected void IsTemplateSelected (TemplateSelectionOptions templateOptions, string addToExistingSolution = null)
		{
//			var newProject = new NewProjectController ();
//			try {
//				newProject.WaitForOpen ();
//			} catch (TimeoutException) {
//				if (!string.IsNullOrEmpty (addToExistingSolution))
//					newProject.Open (addToExistingSolution);
//				else
//					newProject.Open ();
//			}
//			newProject.IsSelected (templateOptions);
		}
		protected virtual void OnSelectTemplate (NewProjectController newProject, TemplateSelectionOptions templateOptions)
		{
			if (!newProject.SelectTemplateType (templateOptions.CategoryRoot, templateOptions.Category)) {
				throw new TemplateSelectionException (string.Format ("Failed to select Category '{0}' under '{1}'", 
					templateOptions.Category, templateOptions.CategoryRoot));
			}
			TakeScreenShot ("TemplateCategorySelected");

			if (!newProject.SelectTemplate (templateOptions.TemplateKindRoot, templateOptions.TemplateKind)) {
				throw new TemplateSelectionException (string.Format ("Failed to select Template '{0}' under '{1}'", 
					templateOptions.TemplateKind, templateOptions.TemplateKindRoot));
			}
			TakeScreenShot ("TemplateSelected");

			if (!newProject.Next ()) {
				throw new TemplateSelectionException ("Clicking Next failed after selecting template");
			}
			TakeScreenShot ("NextAfterTemplateSelected");
		}
		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);
		}
示例#48
0
		protected void GitCreateAndCommit (TemplateSelectionOptions templateOptions, string commitMessage)
		{
			CreateProject (templateOptions, 
				new ProjectDetails (templateOptions),
				new GitOptions { UseGit = true, UseGitIgnore = true });

			Session.WaitForElement (IdeQuery.TextArea);
			TestCommit (commitMessage);

			Session.ExecuteCommand (FileCommands.CloseFile);
			Session.WaitForElement (IdeQuery.TextArea);
		}
		public void Select (TemplateSelectionOptions templateOptions)
		{
			SelectTemplateType (templateOptions.CategoryRoot, templateOptions.Category);
			SelectTemplate (templateOptions.TemplateKindRoot, templateOptions.TemplateKind);
		}
示例#50
0
 public void Select(TemplateSelectionOptions templateOptions)
 {
     SelectTemplateType(templateOptions.CategoryRoot, templateOptions.Category);
     SelectTemplate(templateOptions.TemplateKindRoot, templateOptions.TemplateKind);
 }
		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");
			}
		}
示例#52
0
        public bool IsSelected(TemplateSelectionOptions templateOptions)
        {
            return(true);
//			return Session.SelectElement (templateCategoriesTreeViewQuery) && IsTemplateTypeSelected (templateOptions.CategoryRoot, templateOptions.Category)
//				&& Session.SelectElement (templatesTreeViewQuery) && IsTemplateSelected (templateOptions.TemplateKindRoot, templateOptions.TemplateKind);
        }
		public ProjectDetails (TemplateSelectionOptions templateData) : this ()
		{
			ProjectName = CreateBuildTemplatesTestBase.GenerateProjectName (templateData.TemplateKind);
			SolutionName = ProjectName;
		}
示例#54
0
		public void TestStashAndUnstashSuccessful ()
		{
			var templateOptions = new TemplateSelectionOptions {
				CategoryRoot = OtherCategoryRoot,
				Category = ".NET",
				TemplateKindRoot = GeneralKindRoot,
				TemplateKind = "Console Project"
			};
			GitCreateAndCommit (templateOptions, "First commit");

			var changeDescription = MakeSomeChangesAndSaveAll ("Program.cs");
			TestGitStash (changeDescription);
			Session.WaitForElement (IdeQuery.TextArea);
			TakeScreenShot ("After-Stash");

			TestGitUnstash ();
			TakeScreenShot ("Untash-Successful");
		}