public async Task <IEnumerable <Test> > GetTestsAsync(Int32 RunID) { return(await Task.Run <IEnumerable <Test> > ( async() => { var tests = (JArray)_api.TestRailAPI.SendGet("get_tests/" + RunID); Test[] items = new Test[tests.Count]; var i = 0; foreach (var test in tests) { items[i++] = new Test() { ID = test["id"].Value <Int32>(), Case = await FindCaseAsync(test["case_id"].Value <Int32>()), Status = GlobalStatuses.First(x => x.ID == test["status_id"].Value <Int32>()), Priority = test["priority_id"].Value <Int32?>().HasValue ? GlobalPriorities.First(x => x.ID == test["priority_id"].Value <Int32>()) : new Priority(), Reference = test["refs"].Value <String>() ?? "N/A", Title = test["title"].Value <String>() ?? "N/A", Type = test["type_id"].Value <Int32?>().HasValue ? GlobalCaseTypes.First(x => x.ID == test["type_id"].Value <Int32>()) : new Models.TestRailModels.Type(), Area = (test["custom_area"] != null && test["custom_area"].Value <Int32?>().HasValue) ? GlobalAreas.First(x => x.ID == test["custom_area"].Value <Int32>()): new Area(), Feature = (test["custom_feature"] != null && test["custom_feature"].Value <Int32?>().HasValue) ? GlobalFeatures.First(x => x.ID == test["custom_feature"].Value <Int32>()) : new Feature(), } } ; return items; })); }
public async Task <Test> FindTestAsync(Int32 ID) { return(await Task.Run <Test> ( async() => { var test = (JObject)_api.TestRailAPI.SendGet("get_test/" + ID); return new Test() { ID = test["id"].Value <Int32>(), Case = await FindCaseAsync(test["case_id"].Value <Int32>()), Status = GlobalStatuses.First(x => x.ID == test["status_id"].Value <Int32>()), Priority = test["priority_id"].Value <Int32?>().HasValue ? GlobalPriorities.First(x => x.ID == test["priority_id"].Value <Int32>()) : new Priority(), Reference = test["refs"].Value <String>() ?? "N/A", Title = test["title"].Value <String>() ?? "N/A", Type = test["type_id"].Value <Int32?>().HasValue ? GlobalCaseTypes.First(x => x.ID == test["type_id"].Value <Int32>()) : new Models.TestRailModels.Type(), Area = (test["custom_area"] != null && test["custom_area"].Value <Int32?>().HasValue) ? GlobalAreas.First(x => x.ID == test["custom_area"].Value <Int32>()): new Area(), Feature = (test["custom_feature"] != null && test["custom_feature"].Value <Int32?>().HasValue) ? GlobalFeatures.First(x => x.ID == test["custom_feature"].Value <Int32>()) : new Feature(), }; } )); }
public IEnumerable <Test> GetTests(Int32 RunID) { var tests = (JArray)_api.TestRailAPI.SendGet("get_tests/" + RunID); return(tests.Select ( test => new Test() { ID = test["id"].Value <Int32>(), Case = FindCase(test["case_id"].Value <Int32>()), Status = GlobalStatuses.First(x => x.ID == test["status_id"].Value <Int32>()), Priority = test["priority_id"].Value <Int32?>().HasValue ? GlobalPriorities.First(x => x.ID == test["priority_id"].Value <Int32>()) : new Priority(), Reference = test["refs"].Value <String>() ?? "N/A", Title = test["title"].Value <String>() ?? "N/A", Type = test["type_id"].Value <Int32?>().HasValue ? GlobalCaseTypes.First(x => x.ID == test["type_id"].Value <Int32>()) : new Models.TestRailModels.Type(), Area = (test["custom_area"] != null && test["custom_area"].Value <Int32?>().HasValue) ? GlobalAreas.First(x => x.ID == test["custom_area"].Value <Int32>()): new Area(), Feature = (test["custom_feature"] != null && test["custom_feature"].Value <Int32?>().HasValue) ? GlobalFeatures.First(x => x.ID == test["custom_feature"].Value <Int32>()) : new Feature(), })); }
public Test FindTest(Int32 ID) { var test = (JObject)_api.TestRailAPI.SendGet("get_test/" + ID); return(new Test() { ID = test["id"].Value <Int32>(), Case = FindCase(test["case_id"].Value <Int32>()), Priority = test["priority_id"].Value <Int32?>().HasValue ? GlobalPriorities.First(x => x.ID == test["priority_id"].Value <Int32>()) : new Priority(), Reference = test["refs"].Value <String>() ?? "N/A", Title = test["title"].Value <String>() ?? "N/A", Type = test["type_id"].Value <Int32?>().HasValue ? GlobalCaseTypes.First(x => x.ID == test["type_id"].Value <Int32>()) : new Models.TestRailModels.Type(), Area = (test["custom_area"] != null && test["custom_area"].Value <Int32?>().HasValue) ? GlobalAreas.First(x => x.ID == test["custom_area"].Value <Int32>()): new Area(), Feature = (test["custom_feature"] != null && test["custom_feature"].Value <Int32?>().HasValue) ? GlobalFeatures.First(x => x.ID == test["custom_feature"].Value <Int32>()) : new Feature(), }); }