public TestCaseStoreSub caseResultStore(string id, string name, string outcome) { TestCaseStoreSub dataStore12 = new TestCaseStoreSub(); dataStore12.ID = id; dataStore12.Name = name; dataStore12.Outcome = outcome; return(dataStore12); }
public JsonResult TestCasesFromTestSuit(string testPlanId, string testSuitId) { TestCasesFromSuits testresult = logic.TestCaseFromSuit(testPlanId, testSuitId); // TestRunById testrun = new TestRunById(); List <TestRunById> RunList = new List <TestRunById>(); TestRunProject testProData = logic.GetRunByProject(); foreach (var test in testProData.value) { TestRunById runData = logic.GetRunByRunId(test.id.ToString()); RunList.Add(runData); ListClass.RunList.Add(runData); } string outcome1 = string.Empty; foreach (var test in testresult.value) { TestCaseStoreSub dataStore1 = new TestCaseStoreSub(); List <int> maxStore = new List <int>(); // List<string> runStore = new List<string>(); foreach (var run in RunList) { foreach (var run1 in run.value) { if (run1.testCase.id == null || run1.testCase.id == "") { } else { if (run1.testCase.id.ToString() == test.workItem.id.ToString()) { //TestResult.TestCaseList.Add(testresult); //TestResult.TestRun.Add(run); int runid = Convert.ToInt32(run1.testRun.id); maxStore.Add(runid); // runStore.Add(run); } } } } if (maxStore == null || maxStore.Count <= 0) { outcome1 = "Not Yet Runned"; } if (maxStore != null && maxStore.Count > 0) { var maxId = maxStore.Max(); //RunList.Find(); // TestRunById dataQuery =new TestRunById(); foreach (var i in RunList) { // var dataQuery = i.value.Find(x => x.testRun.id == maxId.ToString()); foreach (var k in i.value) { if (k.testRun.id == maxId.ToString()) { if (k.outcome != null) { outcome1 = k.outcome.ToString(); //dataStore1.ID = test.workItem.id.ToString(); //dataStore1.Name = test.workItem.name.ToString(); //dataStore1.Outcome = outcome1; } else { outcome1 = "Not Yet runned"; } } } } } dataStore1 = caseResultStore(test.workItem.id.ToString(), test.workItem.name.ToString(), outcome1); dataStoreList.Add(dataStore1); } // return(Json(dataStoreList, JsonRequestBehavior.AllowGet)); }