public void OpenEditCompile() { var slnFile = Ide.OpenTestSolution("ConsoleApp-VS2010/ConsoleApplication.sln"); var slnDir = slnFile.ParentDirectory; var exe = slnDir.Combine("bin", "Debug", "ConsoleApplication.exe"); Assert.IsFalse(File.Exists(exe)); Ide.OpenFile(slnFile.ParentDirectory.Combine("Program.cs")); Ide.BuildSolution(); AssertExeHasOutput(exe, ""); //select text editor, move down 10 lines, and insert a statement Session.SelectActiveWidget(); for (int n = 0; n < 10; n++) { Session.ExecuteCommand(TextEditorCommands.LineDown); } Session.ExecuteCommand(TextEditorCommands.LineEnd); Session.TypeText("\nConsole.WriteLine (\"Hello World!\");"); Ide.BuildSolution(); AssertExeHasOutput(exe, "Hello World!"); Ide.CloseAll(); }
protected virtual void OnBuildTemplate(int buildTimeoutInSecs = 180) { try { Assert.IsTrue(Ide.BuildSolution(timeoutInSecs: buildTimeoutInSecs), "Build Failed"); TakeScreenShot("AfterBuildFinishedSuccessfully"); } catch (TimeoutException e) { TakeScreenShot("AfterBuildFailed"); Assert.Fail(e.ToString()); } }
protected virtual void OnBuildTemplate(int buildTimeoutInSecs = 180) { ReproStep("Build solution"); try { Assert.IsTrue(Ide.BuildSolution(timeoutInSecs: buildTimeoutInSecs), "Build Failed"); TakeScreenShot("AfterBuildFinishedSuccessfully"); } catch (TimeoutException e) { Session.DebugObject.Debug("Build Failed"); ReproStep(string.Format("Expected: Build should finish within '{0}' seconds\nActual: Build timed out", buildTimeoutInSecs)); TakeScreenShot("AfterBuildFailed"); Assert.Fail(e.ToString()); } }
public void CreateBuildProject() { string projectName = "TestFoo"; string projectCategory = "C#"; string projectKind = "Console Project"; var projectDirectory = Util.CreateTmpDir(projectName); Ide.CreateProject(projectName, projectCategory, projectKind, projectDirectory); Ide.BuildSolution(); Ide.CloseAll(); }
public void OpenEditCompile() { var slnFile = Ide.OpenTestSolution("ConsoleApp-VS2010/ConsoleApplication.sln"); var slnDir = slnFile.ParentDirectory; var exe = slnDir.Combine("bin", "Debug", "ConsoleApplication.exe"); Assert.IsFalse(File.Exists(exe)); Ide.OpenFile(slnFile.ParentDirectory.Combine("Program.cs")); //select text editor, move down 10 lines, and insert a statement Session.SelectActiveWidget(); Session.ExecuteCommand(TextEditorCommands.DocumentStart); // Delete all the code already existing for (int i = 0; i < 20; i++) { Session.ExecuteCommand(TextEditorCommands.DeleteLine); } // Entering Program With an Error Session.TypeText("\nusing System;"); Session.TypeText("\nnamespace ConsoleProject {"); Session.TypeText("\nclass MainClass {"); Session.TypeText("\npublic static void Main (string[] args) {"); Session.TypeText("\nList<string> s = new List<string> () {\"one\", \"two\", \"three\"};"); Session.TypeText("\nConsole.WriteLine (\"Hello Xamarin!\"); }"); Session.TypeText("\n} }"); Ide.BuildSolution(); AssertExeHasOutput(exe, "Hello Xamarin!"); Ide.CloseAll(); }
public void ZCorrectIt() { var slnFile = Ide.OpenTestSolution("ConsoleApp-VS2010/ConsoleApplication.sln"); var slnDir = slnFile.ParentDirectory; var exe = slnDir.Combine("bin", "Debug", "ConsoleApplication.exe"); Assert.IsFalse(File.Exists(exe)); Ide.OpenFile(slnFile.ParentDirectory.Combine("Program.cs")); Session.SelectActiveWidget(); for (int i = 0; i < 20; i++) { Session.ExecuteCommand(TextEditorCommands.DeleteLine); } Session.ExecuteCommand(TextEditorCommands.DocumentStart); Session.ExecuteCommand(TextEditorCommands.InsertNewLine); // Entering the Correct Program Session.TypeText("\nusing System;"); Session.TypeText("\nusing System.Collections.Generic;"); Session.TypeText("\nnamespace ConsoleProject {"); Session.TypeText("\nclass MainClass {"); Session.TypeText("\npublic static void Main (string[] args) {"); Session.TypeText("\nList<string> s = new List<string> () {\"one\", \"two\", \"three\"};"); Session.TypeText("\nConsole.WriteLine (\"Hello Xamarin!\"); }"); Session.TypeText("\n} }"); Session.ExecuteCommand(TextEditorCommands.LineDown); Ide.BuildSolution(); AssertExeHasOutput(exe, "Hello Xamarin!"); Ide.CloseAll(); }
public void CreateBuildProject(string projectName, string categoryRoot, string category, string kindRoot, string kind, Action beforeBuild) { var solutionParentDirectory = Util.CreateTmpDir(projectName); string actualSolutionDirectory = string.Empty; try { var newProject = new NewProjectController(); newProject.Open(); SelectTemplate(newProject, categoryRoot, category, kindRoot, kind); Assert.IsTrue(newProject.Next()); // Wait until the next page is displayed Session.WaitForElement(c => c.Textfield().Marked("solutionNameTextBox")); EnterProjectDetails(newProject, projectName, projectName, solutionParentDirectory); Assert.IsTrue(newProject.CreateProjectInSolutionDirectory(false)); Assert.IsTrue(newProject.UseGit(true, false)); Session.RunAndWaitForTimer(() => newProject.Next(), "Ide.Shell.SolutionOpened"); actualSolutionDirectory = GetSolutionDirectory(); beforeBuild(); Assert.IsTrue(Ide.BuildSolution()); } finally { Ide.CloseAll(); try { if (Directory.Exists(actualSolutionDirectory)) { Directory.Delete(actualSolutionDirectory, true); } } catch (IOException) { } } }