public void ToStringSerialisesAllValues()
 {
     BuildIntegrationRequest request = new BuildIntegrationRequest();
     request.Identifier = "identifier";
     request.ProjectName = "projectName";
     request.ServerName = "serverName";
     request.SessionToken = "sessionToken";
     request.SourceName = "sourceName";
     request.Timestamp = DateTime.Now;
     request.BuildCondition = BuildCondition.IfModificationExists;
     request.AddBuildValue("value1", "actual value");
     string actual = request.ToString();
     string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture,"<integrationMessage xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
         "timestamp=\"{4:yyyy-MM-ddTHH:mm:ss.FFFFFFFzzz}\" identifier=\"{0}\" server=\"{1}\" source=\"{2}\" session=\"{3}\" project=\"{5}\" condition=\"{6}\">" + 
         "<buildValue name=\"value1\" value=\"actual value\" />" + 
         "</integrationMessage>",
         request.Identifier,
         request.ServerName,
         request.SourceName,
         request.SessionToken,
         request.Timestamp,
         request.ProjectName,
         request.BuildCondition);
     Assert.AreEqual(expected, actual);
 }
 public void AddBuildValueAddsToUnderlyingList()
 {
     BuildIntegrationRequest request = new BuildIntegrationRequest();
     request.AddBuildValue("value1", "actual value");
     string actual = NameValuePair.FindNamedValue(request.BuildValues, "value1");
     Assert.AreEqual("actual value", actual);
 }
 public void GetSetAllPropertiesWorks()
 {
     BuildIntegrationRequest request = new BuildIntegrationRequest();
     var values = new List<NameValuePair>();
     request.BuildCondition = BuildCondition.IfModificationExists;
     request.BuildValues = values;
     Assert.AreSame(values, request.BuildValues);
     Assert.AreEqual(BuildCondition.IfModificationExists, request.BuildCondition, "BuildCondition fails the get/set test");
 }
 public void InitialiseRequestWithSessionSetsTheCorrectValues()
 {
     string sessionToken = "the session";
     DateTime now = DateTime.Now;
     BuildIntegrationRequest request = new BuildIntegrationRequest(sessionToken);
     Assert.IsFalse(string.IsNullOrEmpty(request.Identifier), "Identifier was not set");
     Assert.AreEqual(Environment.MachineName, request.SourceName, "Source name doesn't match the machine name");
     Assert.AreEqual(sessionToken, request.SessionToken, "SessionToken doesn't match the input token");
     Assert.IsTrue((now <= request.Timestamp), "Timestamp was not set");
 }
 public void ToStringSerialisesDefaultValues()
 {
     BuildIntegrationRequest request = new BuildIntegrationRequest();
     string actual = request.ToString();
     string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture,"<integrationMessage xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
         "timestamp=\"{2:yyyy-MM-ddTHH:mm:ss.FFFFFFFzzz}\" identifier=\"{0}\" source=\"{1}\" condition=\"{3}\" />",
         request.Identifier,
         request.SourceName,
         request.Timestamp,
         request.BuildCondition);
     Assert.AreEqual(expected, actual);
 }
Пример #6
0
        /// <summary>
        /// Sends a build request to the server.
        /// </summary>
        /// <param name="projectName">The name of the project to use.</param>
        /// <param name="integrationRequest"></param>
        public override void Request(string projectName, IntegrationRequest integrationRequest)
        {
            if (string.IsNullOrEmpty(projectName)) throw new ArgumentNullException("projectName");

            BuildIntegrationRequest request = new BuildIntegrationRequest(SessionToken, projectName);
            request.BuildCondition = integrationRequest.BuildCondition;
            request.ServerName = TargetServer;
            Response resp = connection.SendMessage("ForceBuild", request);
            ValidateResponse(resp);
        }
Пример #7
0
        /// <summary>
        /// Forces a build for the named project with some parameters.
        /// </summary>
        /// <param name="projectName">project to force</param>
        /// <param name="parameters"></param>
        public override void ForceBuild(string projectName, List<NameValuePair> parameters)
        {
            if (string.IsNullOrEmpty(projectName)) throw new ArgumentNullException("projectName");

            BuildIntegrationRequest request = new BuildIntegrationRequest(SessionToken, projectName);
            request.BuildValues = parameters;
            request.ServerName = TargetServer;
            Response resp = connection.SendMessage("ForceBuild", request);
            ValidateResponse(resp);
        }
Пример #8
0
        /// <summary>
        /// Requests the specified project name.	
        /// </summary>
        /// <param name="projectName">Name of the project.</param>
        /// <param name="integrationRequest">The integration request.</param>
        /// <remarks></remarks>
		public void Request(string projectName, IntegrationRequest integrationRequest)
		{
            BuildIntegrationRequest request = new BuildIntegrationRequest(null, projectName);
            request.BuildCondition = integrationRequest.BuildCondition;
            Response resp = cruiseServer.ForceBuild(request);
            ValidateResponse(resp);
		}
 public void GetSetAllPropertiesWorks()
 {
     BuildIntegrationRequest request = new BuildIntegrationRequest();
     request.BuildCondition = BuildCondition.IfModificationExists;
     Assert.AreEqual(BuildCondition.IfModificationExists, request.BuildCondition, "BuildCondition fails the get/set test");
 }