コード例 #1
0
        public void JobConfigTest()
        {
            // Arrange
            string orgConfig = null;
            string updConfig = null;
            string cngConfig = null;
            string descOrg   = null;
            string descCng   = null;

            // Act
            using (Jenkins jenkins = new Jenkins(host, this.login, this.password))
            {
                orgConfig = jenkins.GetJobConfigAsync("FreestyleConfig").Result;
                descOrg   = GetConfigDescription(orgConfig);

                cngConfig = SetConfigDescription(orgConfig, "Test Description");
                jenkins.SetJobConfigAsync("FreeStyleConfig", cngConfig).Wait();
                updConfig = jenkins.GetJobConfigAsync("FreeStyleConfig").Result;
                descCng   = GetConfigDescription(updConfig);

                jenkins.SetJobConfigAsync("FreeStyleConfig", orgConfig).Wait();
            }

            // Assert
            Assert.IsNotNull(orgConfig);
            Assert.IsNotNull(updConfig);
            Assert.IsNotNull(cngConfig);
            Assert.AreEqual("Default Description", descOrg, nameof(descOrg));
            Assert.AreEqual("Test Description", descCng, nameof(descCng));
        }