public IUndoableEdit DeleteCommonTestCases(State state, IList <Dependency> deps) { if (structure == null) { throw new NullReferenceException("The structure cannot be null"); } CompoundEdit ce = new CompoundEdit(); IList <TestCase> deletedTestCases = new List <TestCase>(); foreach (TestCase testCase in structure.TestCases) { if (testCase.CurrentState == state) { if (hasCommonDependency(testCase, deps)) { deletedTestCases.Add(testCase); } } } foreach (TestCase tc in deletedTestCases) { ce.AddEdit(EditFactory.instance.CreateRemoveTestCaseEdit(structure, tc)); structure.RemoveTestCase(tc); } return(ce); }
public void CreateRemoveTestCaseEditTest() { TestCasesStructure structure = new TestCasesStructure(); TestCase testCase = new TestCase(structure); ce.AddEdit(EditFactory.instance.CreateRemoveTestCaseEdit(structure, testCase)); structure.RemoveTestCase(testCase); ce.End(); ce.Undo(); Assert.IsTrue(structure.TestCases.Contains(testCase)); ce.Redo(); Assert.IsFalse(structure.TestCases.Contains(testCase)); }