/// <summary> /// Pastes the suite to parent. /// </summary> /// <param name="testManagementTeamProject">The test management team project.</param> /// <param name="testPlan">The test plan.</param> /// <param name="parentSuiteId">The parent suite unique identifier.</param> /// <param name="suiteToAddId">The suite automatic add unique identifier.</param> /// <param name="clipBoardCommand">The clip board command.</param> /// <exception cref="System.ArgumentException">The requirments based suites cannot have child suites!</exception> public static void PasteSuiteToParent(ITestManagementTeamProject testManagementTeamProject, ITestPlan testPlan, int parentSuiteId, int suiteToAddId, ClipBoardCommand clipBoardCommand) { ITestSuiteBase parentSuite = null; ITestSuiteBase suiteToAdd = null; try { parentSuite = testManagementTeamProject.TestSuites.Find(parentSuiteId); } catch (TestManagementValidationException ex) { log.Error(ex); } try { suiteToAdd = testManagementTeamProject.TestSuites.Find(suiteToAddId); } catch (TestManagementValidationException ex) { log.Error(ex); } IStaticTestSuite oldParent = suiteToAdd.Parent; if (parentSuite != null && parentSuite is IRequirementTestSuite) { throw new ArgumentException("The requirments based suites cannot have child suites!"); } if (parentSuite != null && parentSuite is IStaticTestSuite && parentSuiteId != -1) { IStaticTestSuite parentSuiteStatic = parentSuite as IStaticTestSuite; parentSuiteStatic.Entries.Add(suiteToAdd); log.InfoFormat("Add child suite to suite with Title= {0}, Id = {1}, child suite title= {2}, id= {3}", parentSuite.Title, parentSuite.Id, suiteToAdd.Title, suiteToAdd.Id); } else { testPlan.RootSuite.Entries.Add(suiteToAdd); } if (clipBoardCommand.Equals(ClipBoardCommand.Cut)) { DeleteSuite(testManagementTeamProject, testPlan, suiteToAddId, oldParent); } testPlan.Save(); }