public void ServerTest()
        {
            // Arrange
            JenkinsModelHudson server = null;

            // Act
            using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password))
            {
                server = jenkins.GetServerAsync().Result;
            }

            // Assert
            Assert.IsNotNull(server, nameof(server));
            Assert.AreEqual("hudson.model.Hudson", server.Class, nameof(server.Class));

            Assert.AreEqual("Hello World", server.Description, nameof(server.Description));
            Assert.AreEqual(0, server.SlaveAgentPort, nameof(server.SlaveAgentPort));
            Assert.AreEqual($"{this.host}", server.Url, nameof(server.Url));
            Assert.AreEqual(true, server.UseCrumbs, nameof(server.UseCrumbs));
            Assert.AreEqual(true, server.UseSecurity, nameof(server.UseSecurity));

            Assert.AreEqual(JenkinsModelNodeMode.Normal, server.Mode, nameof(server.Mode));
            Assert.AreEqual("the master Jenkins node", server.NodeDescription, nameof(server.NodeDescription));
            Assert.AreEqual("", server.NodeName, nameof(server.NodeName));
            Assert.AreEqual(1, server.NumExecutors, nameof(server.NumExecutors));

            Assert.IsNotNull(server.AssignedLabels, nameof(server.AssignedLabels));
            Assert.IsNotNull(server.Jobs, nameof(server.Jobs));
            Assert.IsNotNull(server.OverallLoad, nameof(server.OverallLoad));
            Assert.IsNotNull(server.PrimaryView, nameof(server.PrimaryView));
            Assert.IsNotNull(server.Views, nameof(server.Views));
        }
Beispiel #2
0
        public void ServerTest()
        {
            JenkinsModelHudson server = null;

            using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password))
            {
                server = jenkins.GetServerAsync().Result;
            }

            Assert.IsNotNull(server);
            Assert.IsNotNull(server.AssignedLabels, "assignedLabels");

            //Assert.AreEqual(this.serverMode, server.Mode, "mode");
            Assert.AreEqual("the master Jenkins node", server.NodeDescription, "nodeDescription");
            Assert.AreEqual("", server.NodeName, "nodeName");
            Assert.AreEqual(4, server.NumExecutors, "numExecutors");
            Assert.AreEqual(null, server.Description, "description");

            Assert.IsNotNull(server.Jobs, "jobs");

            Assert.IsNotNull(server.OverallLoad, "overallLoad");

            Assert.IsNotNull(server.PrimaryView, "primaryView");

            Assert.AreEqual(-1, server.SlaveAgentPort, "slaveAgentPort");
            Assert.AreEqual(true, server.UseCrumbs, "useCrumbs");
            Assert.AreEqual(true, server.UseSecurity, "useSecurity");

            Assert.IsNotNull(server.Views, "views");

            Assert.AreEqual("", server.NodeName, "nodeName");
        }
        public void LoginEmptyTest()
        {
            // Arrange
            JenkinsModelHudson server = null;

            // Act
            using (Jenkins jenkins = new Jenkins(this.host))
            {
                server = jenkins.GetServerAsync().Result;
            }

            // Assert
        }
        public void LoginFailedTest()
        {
            // Arrange
            JenkinsModelHudson server = null;

            // Act
            using (Jenkins jenkins = new Jenkins(this.host, "Mustermann", "Max"))
            {
                server = jenkins.GetServerAsync().Result;
            }

            // Assert
        }
        public void LoginTokenTest()
        {
            // Arrange
            JenkinsModelHudson server = null;
            JenkinsModelUser   user   = null;

            // Act
            using (Jenkins jenkins = new Jenkins(this.host, this.login, this.token))
            {
                server = jenkins.GetServerAsync().Result;
                user   = jenkins.GetCurrentUserAsync().Result;
            }

            // Assert
            Assert.IsNotNull(server);
            Assert.IsNotNull(user);
            Assert.AreEqual(login, user.FullName, nameof(user.FullName));
        }