void onContentChanged(TestStepList sender, ChildStepsChangedAction Action, ITestStep Object, int Index) { if (Parent != null && Parent.Parent != null && Parent.Parent.ChildTestSteps != null) { Parent.Parent.ChildTestSteps.onContentChanged(sender, Action, Object, Index); } if (ChildStepsChanged != null) { ChildStepsChanged(sender, Action, Object, Index); } }
private void TestStepList_ChildStepsChanged(TestStepList senderList, ChildStepsChangedAction Action, ITestStep Object, int Index) { if (idLookup == null) { rebuildIdLookup(); } if (Action == ChildStepsChangedAction.RemovedStep) { foreach (var thing in Utils.FlattenHeirarchy(new[] { Object }, x => x.ChildTestSteps)) { idLookup.Remove(thing.Id); } } else if (Action == ChildStepsChangedAction.AddedStep) { foreach (var thing in Utils.FlattenHeirarchy(new[] { Object }, x => x.ChildTestSteps)) { // in some cases a thing can be added twice. // happens for TestPlanReference. Hence we should use [] and not Add idLookup[thing.Id] = thing; } } }