public void PR_GetPRModel_Test() { var query = @"https://bizai.visualstudio.com/DefaultCollection/BizAI/_apis/git/repositories/SalesIntelligence/pullRequests?status=Completed"; var vso = this.config[SolutionConfigName.VSO_NAME].ToString(); var project = this.config[SolutionConfigName.VSO_PROJECT_NAME].ToString(); var token = this.config[SolutionConfigName.PERSONAL_ACCESS_TOKEN].ToString(); var prModelList = PullRequestUtil.GetPullRequestDBModel( vso, project, query, "SalesIntelligence", token); Assert.IsTrue(prModelList.Count > 0); }
public void CollectPullRequestData(int prPerRequest, int numOfRequest) { var metricList = new List <Metric>(); var token = this.config[SolutionConfigName.PERSONAL_ACCESS_TOKEN].ToString(); foreach (var repo in (this.config[SolutionConfigName.PULL_REQUEST_REPOSITORIES] as string[])) { var skip = 0; for (var i = 0; i < numOfRequest; ++i) { var query = PullRequestUtil.GetQueryStringWithPaging(this.config[SolutionConfigName.VSO_NAME].ToString(), this.config[SolutionConfigName.VSO_PROJECT_NAME].ToString(), repo, prPerRequest, skip, "Completed" ); skip += prPerRequest; var pullRequestFromVSO = PullRequestUtil.GetPullRequestDBModel( this.config[SolutionConfigName.VSO_NAME].ToString(), this.config[SolutionConfigName.VSO_PROJECT_NAME].ToString(), query, repo, token); foreach (var pr in pullRequestFromVSO) { var detail = new Dictionary <string, object>(); detail["VSO"] = pr.VSO; detail["Project"] = pr.Project; detail["Repository"] = repo; detail["PRId"] = pr.PRId; detail["CountOfCommentNotFixed"] = pr.CountOfCommentNotFixed; detail["CreationDate"] = pr.CreationDate; var metric = new Metric("PullRequest", MetricType.PullRequest, detail); metricList.Add(metric); } } } writer.Write(metricList); }