示例#1
0
        public BuildStatus GetBuildInformation(int maxDays = 5, int maxRuns = 10, string teamProject = "*", string buildDefinition = "")
        {
            var buildStatus = new BuildStatus();

            var builds = GetBuildsFromTfs(maxDays, teamProject, buildDefinition);

            var currentDefinition = string.Empty;

            foreach (var build in builds)
            {
                string definitionName = build.BuildDefinition.Name;
                var project = MapBuildToProject(build, definitionName);

                if (definitionName == currentDefinition)
                {
                    AddBuildToParentProject(buildStatus, definitionName, project, maxRuns);
                }
                else
                {
                    currentDefinition = definitionName;
                    buildStatus.Projects.Add(project);
                }
            }
            return buildStatus;
        }
示例#2
0
        public BuildStatus GetBuildInformation(int maxDays, int maxRuns, string teamProject, IList<string> buildDefinitions)
        {
            var buildStatus = new BuildStatus();

            foreach (var bd in buildDefinitions)
            {
                var builds = GetBuildsFromTfs(maxDays, teamProject, bd);
                if(builds.Any())
                {
                    var project = MapBuildToProject(builds.FirstOrDefault(), builds.FirstOrDefault().BuildDefinition.Name);
                    buildStatus.Projects.Add(project);
                }
            }

            return buildStatus;
        }
示例#3
0
 private void AddBuildToParentProject(BuildStatus buildStatus, string definitionName, Project project, int maxRuns)
 {
     var parent = buildStatus.Projects.First(p => p.DefinitionName == definitionName);
     if (parent.Runs.Count < maxRuns)
     {
         parent.Runs.Add(project);
     }
 }