public void ChangeStatus(string testCaseName, TestCaseStatus status) { TestCaseGroup from = testcasemap[testCaseName]; TestCaseGroup to = OtherTestCases; if (from == null) { return; } TestCase testcase = from.TestCaseList.FirstOrDefault(c => c.Name == testCaseName); if (status == TestCaseStatus.Running) { RunningTestCase = testcase; } switch (status) { case TestCaseStatus.Running: to = InProgressTestCases; break; case TestCaseStatus.Passed: testcase.IsChecked = false; to = PassedTestCases; break; case TestCaseStatus.Failed: testcase.IsChecked = true; to = FailedTestCases; break; case TestCaseStatus.Other: to = OtherTestCases; break; case TestCaseStatus.NotRun: to = NotRunTestCases; break; } testcase.Status = status; if (UpdateTestCaseStatus != null) { UpdateTestCaseStatus(from, to, testcase); } else { from.RemoveTestCase(testcase); to.AddTestCase(testcase); } testcasemap[testCaseName] = to; }
public void ChangeStatus(string testCaseName, TestCaseStatus status) { TestCaseGroup from = testcasemap[testCaseName]; TestCaseGroup to = OtherTestCases; if (from == null) { return; } TestCase testcase = from.TestCaseList.FirstOrDefault(c => c.Name == testCaseName); // If changed to Running/Waiting status, no need to change group. lock (locker) { if (status == TestCaseStatus.Running) { if (RunningTestCase != null) { if (RunningTestCase.Status == TestCaseStatus.Running) { RunningTestCase.Status = TestCaseStatus.Waiting; } } RunningTestCase = testcase; RunningTestCase.Status = status; if (UpdateTestCaseList != null) { UpdateTestCaseList(from, RunningTestCase); } return; } if (status == TestCaseStatus.Waiting) { if (testcase.Status == TestCaseStatus.Running) { testcase.Status = status; return; } } switch (status) { case TestCaseStatus.Passed: testcase.IsChecked = false; to = PassedTestCases; break; case TestCaseStatus.Failed: testcase.IsChecked = true; to = FailedTestCases; break; case TestCaseStatus.Other: to = OtherTestCases; break; case TestCaseStatus.NotRun: to = NotRunTestCases; break; } testcase.Status = status; if (UpdateTestCaseStatus != null) { UpdateTestCaseStatus(from, to, testcase); } else { from.RemoveTestCase(testcase); to.AddTestCase(testcase); } testcasemap[testCaseName] = to; } }