private async Task <List <Defect> > GatherDefects() { List <Defect> defects = new List <Defect>(); var wiqlId = _tfsCommonFunctions.GatherWiqlId("/Shared Queries/Reporting/Defect").Result; var requestUri = "/APHP/" + _project + "/_apis/wit/wiql/" + wiqlId + "?api-version=3.0"; var method = new HttpMethod("GET"); var request = new HttpRequestMessage(method, requestUri) { }; var response = await _client.SendAsync(request); if (response.IsSuccessStatusCode) { string workItem = await response.Content.ReadAsStringAsync(); JObject jo = JObject.Parse(workItem); foreach (JToken item in jo["workItems"]) { Defect currDefect = new Defect(); currDefect.DefectId = item["id"].ToObject <int>(); defects.Add(currDefect); } } return(defects); }
private async Task <int> GetNumberOfTestCasesInPlan() { int res = 0; TFSCommonFunctions commonFunctions = new TFSCommonFunctions(_props); string wiqlId = await commonFunctions.GatherWiqlId("/Shared Queries/Reporting/NumberOfTestCases"); var requestUri = "/APHP/" + _project + "/_apis/wit/wiql/" + wiqlId + "?api-version=3.0"; var method = new HttpMethod("GET"); var request = new HttpRequestMessage(method, requestUri) { }; var response = await _client.SendAsync(request); if (response.IsSuccessStatusCode) { string workItem = await response.Content.ReadAsStringAsync(); JObject jo = JObject.Parse(workItem); res = jo["workItems"].Count <JToken>(); } return(res); }