Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. public static List<TestCase> GetAllTestCasesInTestPlan(ITestManagementTeamProject testManagementTeamProject, ITestPlan testPlan, bool initializeTestCaseStatus = true)
  2. {
  3. testPlan.Refresh();
  4. List<TestCase> testCasesList;
  5. testCasesList = new List<TestCase>();
  6. string fullQuery =
  7. String.Format("SELECT [System.Id], [System.Title] FROM WorkItems WHERE [System.WorkItemType] = 'Test Case' AND [Team Project] = '{0}'", testManagementTeamProject.TeamProjectName);
  8. IEnumerable<ITestCase> allTestCases = testManagementTeamProject.TestCases.Query(fullQuery);
  9. foreach (var currentTestCase in allTestCases)
  10. {
  11. TestCase testCaseToAdd = new TestCase(currentTestCase, currentTestCase.TestSuiteEntry.ParentTestSuite, testPlan, initializeTestCaseStatus);
  12. if (!testCasesList.Contains(testCaseToAdd))
  13. {
  14. testCasesList.Add(testCaseToAdd);
  15. }
  16. }
  17.  
  18. return testCasesList;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement