public void InitialiseRequestWithSessionSetsTheCorrectValues() { string sessionToken = "the session"; DateTime now = DateTime.Now; BuildListRequest request = new BuildListRequest(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() { BuildListRequest request = new BuildListRequest(); string actual = request.ToString(); string expected = string.Format("<buildListMessage 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}\" number=\"0\" />", request.Identifier, request.SourceName, request.Timestamp); Assert.AreEqual(expected, actual); }
public void ToStringSerialisesAllValues() { BuildListRequest request = new BuildListRequest(); request.Identifier = "identifier"; request.ServerName = "serverName"; request.SessionToken = "sessionToken"; request.SourceName = "sourceName"; request.Timestamp = DateTime.Now; request.NumberOfBuilds = 6; string actual = request.ToString(); string expected = string.Format("<buildListMessage 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}\" number=\"6\" />", request.Identifier, request.ServerName, request.SourceName, request.SessionToken, request.Timestamp); Assert.AreEqual(expected, actual); }
/// <summary> /// Returns the names of the buildCount most recent builds for the specified project, sorted s.t. the newest build is first in the array /// </summary> public override string[] GetMostRecentBuildNames(string projectName, int buildCount) { if (string.IsNullOrEmpty(projectName)) throw new ArgumentNullException("projectName"); BuildListRequest request = new BuildListRequest(SessionToken, projectName); request.NumberOfBuilds = buildCount; request.ServerName = TargetServer; DataListResponse resp = ValidateResponse( connection.SendMessage("GetMostRecentBuildNames", request)) as DataListResponse; return resp.Data.ToArray(); }
/// <summary> /// Returns the names of the buildCount most recent builds for the specified project, sorted s.t. the newest build is first in the array /// </summary> public virtual DataListResponse GetMostRecentBuildNames(BuildListRequest request) { return cruiseServer.GetMostRecentBuildNames(request); }
/// <summary> /// Returns the names of the buildCount most recent builds for the specified project, sorted s.t. the newest build is first in the array /// </summary> public string[] GetMostRecentBuildNames(string projectName, int buildCount) { BuildListRequest request = new BuildListRequest(null, projectName); request.NumberOfBuilds = buildCount; DataListResponse resp = cruiseServer.GetMostRecentBuildNames(request); ValidateResponse(resp); return resp.Data.ToArray(); }
/// <summary> /// Returns the names of the buildCount most recent builds for the specified project, sorted s.t. the newest build is first in the array /// </summary> public virtual DataListResponse GetMostRecentBuildNames(BuildListRequest request) { string[] data = { }; DataListResponse response = new DataListResponse(RunProjectRequest(request, SecurityPermission.ViewProject, null, delegate { data = GetIntegrator(request.ProjectName) .IntegrationRepository .GetMostRecentBuildNames(request.NumberOfBuilds); })); if (data != null) response.Data.AddRange(data); return response; }
public void GetSetAllPropertiesWorks() { BuildListRequest request = new BuildListRequest(); request.NumberOfBuilds = 6; Assert.AreEqual(6, request.NumberOfBuilds, "NumberOfBuilds fails the get/set test"); }