Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs =================================================================== diff -u -r9ad3a25b98327fbb360663497753e166e095fb4b -r0b28e0b79a31d36c59eb077d172faf73c3c4b65d --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 9ad3a25b98327fbb360663497753e166e095fb4b) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 0b28e0b79a31d36c59eb077d172faf73c3c4b65d) @@ -278,12 +278,9 @@ Text = pipingSurfaceLine => pipingSurfaceLine.Name, Image = pipingSurfaceLine => PipingFormsResources.PipingSurfaceLineIcon, ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) - .AddDeleteItem() .AddSeparator() .AddPropertiesItem() - .Build(), - CanRemove = CanRemoveSurfaceLine, - OnNodeRemoved = OnSurfaceLineRemoved + .Build() }; yield return new TreeNodeInfo @@ -587,7 +584,6 @@ .AddImportItem() .AddUpdateItem() .AddSeparator() - .AddDeleteChildrenItem() .AddSeparator() .AddCollapseAllItem() .AddExpandAllItem() @@ -615,26 +611,6 @@ #endregion - #region RingtoetsPipingSurfaceLine TreeNodeInfo - - private static bool CanRemoveSurfaceLine(RingtoetsPipingSurfaceLine nodeData, object parentData) - { - return parentData is RingtoetsPipingSurfaceLinesContext; - } - - private static void OnSurfaceLineRemoved(RingtoetsPipingSurfaceLine nodeData, object parentData) - { - var context = (RingtoetsPipingSurfaceLinesContext) parentData; - IObservable[] changedObservables = PipingDataSynchronizationService.RemoveSurfaceLine(context.FailureMechanism, nodeData).ToArray(); - - foreach (IObservable observable in changedObservables) - { - observable.NotifyObservers(); - } - } - - #endregion - #region PipingFailureMechanismContext TreeNodeInfo private ContextMenuStrip FailureMechanismEnabledContextMenuStrip(PipingFailureMechanismContext pipingFailureMechanismContext, Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs =================================================================== diff -u -rc290911dd4647e3115e239c8baf814717c098a5a -r0b28e0b79a31d36c59eb077d172faf73c3c4b65d --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs (.../RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs) (revision c290911dd4647e3115e239c8baf814717c098a5a) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs (.../RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs) (revision 0b28e0b79a31d36c59eb077d172faf73c3c4b65d) @@ -30,7 +30,6 @@ using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Piping.Data; using Ringtoets.Piping.Forms.PresentationObjects; -using Ringtoets.Piping.Forms.Properties; using Ringtoets.Piping.Primitives; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; @@ -219,7 +218,6 @@ menuBuilderMock.Expect(mb => mb.AddImportItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.AddUpdateItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock); - menuBuilderMock.Expect(mb => mb.AddDeleteChildrenItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilderMock); Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs =================================================================== diff -u -rd6d1b03ce8dc3c4e6bba565a85ea310f6196adea -r0b28e0b79a31d36c59eb077d172faf73c3c4b65d --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs (.../RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs) (revision d6d1b03ce8dc3c4e6bba565a85ea310f6196adea) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs (.../RingtoetsPipingSurfaceLineTreeNodeInfoTest.cs) (revision 0b28e0b79a31d36c59eb077d172faf73c3c4b65d) @@ -20,18 +20,12 @@ // All rights reserved. using System.Linq; -using Core.Common.Base; -using Core.Common.Base.Geometry; using Core.Common.Controls.TreeView; using Core.Common.Gui; using Core.Common.Gui.ContextMenu; using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Common.Data.AssessmentSection; -using Ringtoets.Common.Data.Calculation; -using Ringtoets.Piping.Data; -using Ringtoets.Piping.Forms.PresentationObjects; using Ringtoets.Piping.Forms.Properties; using Ringtoets.Piping.Primitives; @@ -75,8 +69,8 @@ Assert.IsNull(info.ChildNodeObjects); Assert.IsNull(info.CanRename); Assert.IsNull(info.OnNodeRenamed); - Assert.IsNotNull(info.CanRemove); - Assert.IsNotNull(info.OnNodeRemoved); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); Assert.IsNull(info.CanCheck); Assert.IsNull(info.IsChecked); Assert.IsNull(info.OnNodeChecked); @@ -119,131 +113,11 @@ } [Test] - public void CanRemove_ParentDataIsRingtoetsSurfaceLinesContext_ReturnTrue() - { - // Setup - var assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - - var failureMechanism = new PipingFailureMechanism(); - - var parentData = new RingtoetsPipingSurfaceLinesContext(failureMechanism.SurfaceLines, failureMechanism, assessmentSection); - - // Call - bool canRemove = info.CanRemove(null, parentData); - - // Assert - Assert.IsTrue(canRemove); - } - - [Test] - public void CanRemove_OtherParentData_ReturnFalse() - { - // Call - bool canRemove = info.CanRemove(null, null); - - // Assert - Assert.IsFalse(canRemove); - } - - [Test] - public void OnNodeRemoved_RemovedSurfaceLineAssignedToCalculationInput_SurfaceLineRemovedFromFailureMechanismAndCalculationSurfaceLineCleared() - { - // Setup - var assessmentSection = mocks.Stub(); - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - var calculation1Observer = mocks.StrictMock(); - calculation1Observer.Expect(o => o.UpdateObserver()); - var calculation2Observer = mocks.StrictMock(); - calculation2Observer.Expect(o => o.UpdateObserver()); - var calculation3Observer = mocks.StrictMock(); - calculation3Observer.Expect(o => o.UpdateObserver()).Repeat.Never(); - mocks.ReplayAll(); - - var nodeData = new RingtoetsPipingSurfaceLine(); - nodeData.SetGeometry(new[] - { - new Point3D(1, 2, 3), - new Point3D(4, 5, 6) - }); - var failureMechanism = new PipingFailureMechanism(); - failureMechanism.SurfaceLines.AddRange(new[] - { - nodeData - }, "path"); - var otherSurfaceline = new RingtoetsPipingSurfaceLine(); - otherSurfaceline.SetGeometry(new[] - { - new Point3D(7, 8, 9), - new Point3D(0, 1, 2) - }); - failureMechanism.SurfaceLines.AddRange(new[] - { - otherSurfaceline - }, "path"); - failureMechanism.SurfaceLines.Attach(observer); - - var generalInputs = new GeneralPipingInput(); - var calculation1 = new PipingCalculationScenario(generalInputs) - { - InputParameters = - { - SurfaceLine = nodeData - } - }; - calculation1.InputParameters.Attach(calculation1Observer); - var calculation2 = new PipingCalculationScenario(generalInputs) - { - InputParameters = - { - SurfaceLine = nodeData - } - }; - calculation2.InputParameters.Attach(calculation2Observer); - var calculation3 = new PipingCalculationScenario(generalInputs) - { - InputParameters = - { - SurfaceLine = otherSurfaceline - } - }; - calculation3.InputParameters.Attach(calculation3Observer); - - var groupWithCalculation = new CalculationGroup("A", true) - { - Children = - { - calculation2 - } - }; - - failureMechanism.CalculationsGroup.Children.Add(calculation1); - failureMechanism.CalculationsGroup.Children.Add(groupWithCalculation); - failureMechanism.CalculationsGroup.Children.Add(calculation3); - - var parentNodeData = new RingtoetsPipingSurfaceLinesContext(failureMechanism.SurfaceLines, failureMechanism, assessmentSection); - - // Call - info.OnNodeRemoved(nodeData, parentNodeData); - - // Assert - CollectionAssert.DoesNotContain(failureMechanism.SurfaceLines, nodeData); - - Assert.IsNull(calculation1.InputParameters.SurfaceLine); - Assert.IsNull(calculation2.InputParameters.SurfaceLine); - Assert.IsNotNull(calculation3.InputParameters.SurfaceLine, - "Calculation with different surfaceline should not be affected."); - // Assert expectancies are called in TearDown() - } - - [Test] public void ContextMenuStrip_Always_CallsBuilder() { // Setup var menuBuilderMock = mocks.StrictMock(); - menuBuilderMock.Expect(mb => mb.AddDeleteItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock); menuBuilderMock.Expect(mb => mb.Build()).Return(null); Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/StochasticSoilModelTreeNodeInfoTest.cs =================================================================== diff -u -r01b4452324f921248824277a5441667b822a5662 -r0b28e0b79a31d36c59eb077d172faf73c3c4b65d --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/StochasticSoilModelTreeNodeInfoTest.cs (.../StochasticSoilModelTreeNodeInfoTest.cs) (revision 01b4452324f921248824277a5441667b822a5662) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/StochasticSoilModelTreeNodeInfoTest.cs (.../StochasticSoilModelTreeNodeInfoTest.cs) (revision 0b28e0b79a31d36c59eb077d172faf73c3c4b65d) @@ -21,17 +21,13 @@ using System.Collections.Generic; using System.Linq; -using Core.Common.Base; using Core.Common.Controls.TreeView; using Core.Common.Gui; using Core.Common.Gui.ContextMenu; using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Common.Data.AssessmentSection; -using Ringtoets.Common.Data.Calculation; using Ringtoets.Piping.Data; -using Ringtoets.Piping.Forms.PresentationObjects; using Ringtoets.Piping.Primitives; using PipingFormsResources = Ringtoets.Piping.Forms.Properties.Resources;