Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rf989a06ad41e4081dd1d155fafa263e94b070816 -rfda32224be20ced8ee871a3ab495f11e55d48835 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision f989a06ad41e4081dd1d155fafa263e94b070816) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision fda32224be20ced8ee871a3ab495f11e55d48835) @@ -759,6 +759,39 @@ CollectionAssert.DoesNotContain(group.Children, elementToBeRemoved); } + [Test] + public void OnNodeRemoved_CalculationInGroupAssignedToSection_CalculationDetachedFromSection() + { + // Setup + var group = new CalculationGroup(); + var failureMechanism = new HeightStructuresFailureMechanism(); + var elementToBeRemoved = new HeightStructuresCalculation(); + var assessmentSectionStub = mocks.Stub(); + var calculationContext = new HeightStructuresCalculationContext(elementToBeRemoved, + failureMechanism, + assessmentSectionStub); + var groupContext = new HeightStructuresCalculationGroupContext(group, + failureMechanism, + assessmentSectionStub); + + mocks.ReplayAll(); + + group.Children.Add(elementToBeRemoved); + + failureMechanism.AddSection(new FailureMechanismSection("section", new[] + { + new Point2D(0, 0) + })); + + failureMechanism.SectionResults.First().Calculation = elementToBeRemoved; + + // Call + info.OnNodeRemoved(calculationContext, groupContext); + + // Assert + Assert.IsNull(failureMechanism.SectionResults.First().Calculation); + } + public override void TearDown() { plugin.Dispose();