コード例 #1
0
        public void GetSetAllPropertiesWorks()
        {
            BuildListRequest request = new BuildListRequest();

            request.NumberOfBuilds = 6;
            Assert.AreEqual(6, request.NumberOfBuilds, "NumberOfBuilds fails the get/set test");
        }
コード例 #2
0
        /// <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());
        }
コード例 #3
0
        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");
        }
コード例 #4
0
        public void ToStringSerialisesDefaultValues()
        {
            BuildListRequest request  = new BuildListRequest();
            string           actual   = request.ToString();
            string           expected = string.Format(System.Globalization.CultureInfo.CurrentCulture, "<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);
        }
コード例 #5
0
        protected override int OnExecute(CommandLineApplication app)
        {
            base.OnExecute(app);

            var buildListRequest = new BuildListRequest
            {
                BuildDefinitionId = this.BuildDefinitionId,
                Top         = this.Top,
                BuildNumber = this.BuildNumber,
            };

            IEnumerable <Build> builds = this.DevOpsClient.Build.GetAllAsync(this.ProjectName, buildListRequest).GetAwaiter().GetResult();

            this.PrintOrExport(builds.OrderByDescending(b => b.Id));

            return(ExitCodes.Ok);
        }
コード例 #6
0
        /// <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;
            var resp = this.ValidateResponse(
                connection.SendMessage("GetMostRecentBuildNames", request))
                       as DataListResponse;

            return(resp.Data.ToArray());
        }
コード例 #7
0
        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(System.Globalization.CultureInfo.CurrentCulture, "<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);
        }
コード例 #8
0
 /// <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));
 }