/// <summary> /// Marks the initial steps to be removed. /// </summary> /// <param name="selectedTestSteps">The selected test steps.</param> /// <returns>the list of test steps to be removed</returns> public List <TestStepFull> MarkInitialStepsToBeRemoved(IList <TestStep> selectedTestSteps) { List <TestStepFull> testStepsToBeRemoved = new List <TestStepFull>(); foreach (TestStep currentStepToBeRemoved in selectedTestSteps) { for (int i = 0; i < this.ObservableTestSteps.Count; i++) { if (this.ObservableTestSteps[i].TestStepGuid.Equals(currentStepToBeRemoved.TestStepGuid)) { int index = i - 1; // If the step to be removed is initial we set -2 for index in order the Insert Operation to be completed successfully. // If index == -2 the insert function will insert the test step to the beginning of the collection if (index == -1) { index--; } TestStepFull currentTestStep = new TestStepFull(this.ObservableTestSteps[i], index); if (!testStepsToBeRemoved.Contains(currentTestStep)) { testStepsToBeRemoved.Add(currentTestStep); } } } } return(testStepsToBeRemoved); }
/// <summary> /// Marks the initial steps to be removed. /// </summary> /// <param name="selectedTestSteps">The selected test steps.</param> /// <returns>the list of test steps to be removed</returns> public List<TestStepFull> MarkInitialStepsToBeRemoved(IList<TestStep> selectedTestSteps) { List<TestStepFull> testStepsToBeRemoved = new List<TestStepFull>(); foreach (TestStep currentStepToBeRemoved in selectedTestSteps) { for (int i = 0; i < this.ObservableTestSteps.Count; i++) { if (this.ObservableTestSteps[i].TestStepGuid.Equals(currentStepToBeRemoved.TestStepGuid)) { int index = i - 1; // If the step to be removed is initial we set -2 for index in order the Insert Operation to be completed successfully. // If index == -2 the insert function will insert the test step to the beginning of the collection if (index == -1) { index--; } TestStepFull currentTestStep = new TestStepFull(this.ObservableTestSteps[i], index); if (!testStepsToBeRemoved.Contains(currentTestStep)) { testStepsToBeRemoved.Add(currentTestStep); } } } } return testStepsToBeRemoved; }