public void JobGetGenericTest() { // Arrange JenkinsModelFreeStyleProject freeStyleJob = null; JenkinsModelExternalJob externalJob = null; JenkinsMatrixMatrixProject matrixJob = null; JenkinsJenkinsciWorkflowJob workflowJob = null; JenkinsJenkinsciWorkflowMultiBranchProject multiBranchJob = null; JenkinsCloudbeesFolder folderJob = null; JenkinsBranchOrganizationFolder organizationFolderJob = null; // Act using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { freeStyleJob = jenkins.GetJobAsync <JenkinsModelFreeStyleProject>("FreeStyle").Result; externalJob = jenkins.GetJobAsync <JenkinsModelExternalJob>("ExternalJob").Result; matrixJob = jenkins.GetJobAsync <JenkinsMatrixMatrixProject>("Multiconfiguration").Result; workflowJob = jenkins.GetJobAsync <JenkinsJenkinsciWorkflowJob>("Pipeline").Result; multiBranchJob = jenkins.GetJobAsync <JenkinsJenkinsciWorkflowMultiBranchProject>("MultibranchPipeline").Result; folderJob = jenkins.GetJobAsync <JenkinsCloudbeesFolder>("Folder").Result; organizationFolderJob = jenkins.GetJobAsync <JenkinsBranchOrganizationFolder>("GitHubOrganization").Result; } // Assert Assert.IsNotNull(freeStyleJob); Assert.IsNotNull(externalJob); Assert.IsNotNull(matrixJob); Assert.IsNotNull(workflowJob); Assert.IsNotNull(multiBranchJob); Assert.IsNotNull(folderJob); Assert.IsNotNull(organizationFolderJob); }
public void JobGetTest() { // Arrange JenkinsModelFreeStyleProject freeStyleJob = null; JenkinsModelExternalJob externalJob = null; JenkinsMatrixMatrixProject matrixJob = null; JenkinsJenkinsciWorkflowJob workflowJob = null; JenkinsJenkinsciWorkflowMultiBranchProject multiBranchJob = null; JenkinsCloudbeesFolder folderJob = null; JenkinsBranchOrganizationFolder organizationFolderJob = null; // Act using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { freeStyleJob = jenkins.GetJobAsync("FreeStyle").Result as JenkinsModelFreeStyleProject; externalJob = jenkins.GetJobAsync("ExternalJob").Result as JenkinsModelExternalJob; matrixJob = jenkins.GetJobAsync("Multiconfiguration").Result as JenkinsMatrixMatrixProject; workflowJob = jenkins.GetJobAsync("Pipeline").Result as JenkinsJenkinsciWorkflowJob; multiBranchJob = jenkins.GetJobAsync("MultibranchPipeline").Result as JenkinsJenkinsciWorkflowMultiBranchProject; folderJob = jenkins.GetJobAsync("Folder").Result as JenkinsCloudbeesFolder; organizationFolderJob = jenkins.GetJobAsync("GitHubOrganization").Result as JenkinsBranchOrganizationFolder; } // Assert Assert.IsNotNull(freeStyleJob); Assert.IsNotNull(externalJob); Assert.IsNotNull(matrixJob); Assert.IsNotNull(workflowJob); Assert.IsNotNull(multiBranchJob); Assert.IsNotNull(folderJob); Assert.IsNotNull(organizationFolderJob); Assert.IsNotNull(freeStyleJob.Actions, nameof(freeStyleJob.Actions)); Assert.AreEqual("Project description", freeStyleJob.Description, nameof(freeStyleJob.Description)); Assert.AreEqual("FreeStyle", freeStyleJob.DisplayName, nameof(freeStyleJob.DisplayName)); Assert.AreEqual("FreeStyle", freeStyleJob.Name, nameof(freeStyleJob.Name)); Assert.AreEqual($"{this.host}job/FreeStyle/", freeStyleJob.Url, nameof(freeStyleJob.Url)); Assert.AreEqual(true, freeStyleJob.IsBuildable, nameof(freeStyleJob.IsBuildable)); Assert.IsNotNull(freeStyleJob.Builds, nameof(freeStyleJob.Builds)); //Assert.IsTrue(freeStyleJob.State.HasFlag(JenkinsJobState.Success), "color"); Assert.IsNotNull(freeStyleJob.FirstBuild, nameof(freeStyleJob.FirstBuild)); Assert.IsNotNull(freeStyleJob.HealthReports, nameof(freeStyleJob.HealthReports)); }