Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs =================================================================== diff -u -rd1565906db90df7be4365d277d5ff22dc2d77a82 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d1565906db90df7be4365d277d5ff22dc2d77a82) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -108,9 +108,9 @@ /// /// Looks up a localized string similar to Vakindeling. /// - public static string FailureMechanism_SectionDevisions_DisplayName { + public static string FailureMechanism_Sections_DisplayName { get { - return ResourceManager.GetString("FailureMechanism_SectionDevisions_DisplayName", resourceCulture); + return ResourceManager.GetString("FailureMechanism_Sections_DisplayName", resourceCulture); } } Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx =================================================================== diff -u -rd1565906db90df7be4365d277d5ff22dc2d77a82 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision d1565906db90df7be4365d277d5ff22dc2d77a82) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -129,7 +129,7 @@ Locaties - + Vakindeling Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionsContext.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionsContext.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionsContext.cs (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -0,0 +1,77 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; + +using Ringtoets.Common.Data; + +namespace Ringtoets.Common.Forms.PresentationObjects +{ + /// + /// This class is a presentation object for . + /// + public class FailureMechanismSectionsContext + { + /// + /// Initializes a new instance of the class. + /// + /// The failure mechanism whose sections to wrap. + /// The owning assessment section of . + /// When any input argument is null. + public FailureMechanismSectionsContext(IFailureMechanism failureMechanism, AssessmentSectionBase assessmentSection) + { + if (failureMechanism == null) + { + throw new ArgumentNullException("failureMechanism"); + } + if (assessmentSection == null) + { + throw new ArgumentNullException("assessmentSection"); + } + + ParentFailureMechanism = failureMechanism; + ParentAssessmentSection = assessmentSection; + } + + /// + /// Gets the sequence of instances available + /// on the wrapped failure mechanism. + /// + public IEnumerable WrappedData + { + get + { + return ParentFailureMechanism.Sections; + } + } + + /// + /// Gets failure mechanism that owns the sequence exposed by . + /// + public IFailureMechanism ParentFailureMechanism { get; private set; } + + /// + /// Gets the assessment section that owns . + /// + public AssessmentSectionBase ParentAssessmentSection { get; private set; } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -rc6dd26c14af11a7e13f783f578466e46b463165a -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c6dd26c14af11a7e13f783f578466e46b463165a) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.17929 +// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -240,6 +240,16 @@ } /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap Sections { + get { + object obj = ResourceManager.GetObject("Sections", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// /// Looks up a localized string similar to &Valideren. /// public static string Validate { Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx =================================================================== diff -u -rc6dd26c14af11a7e13f783f578466e46b463165a -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision c6dd26c14af11a7e13f783f578466e46b463165a) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -193,4 +193,7 @@ ..\resources\database.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Sections.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Resources/Sections.png =================================================================== diff -u Binary files differ Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r69bae9f753011e0f962a3ffa9b3c696efe5852dd -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 69bae9f753011e0f962a3ffa9b3c696efe5852dd) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -47,6 +47,7 @@ Code + @@ -123,6 +124,7 @@ + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionsContextTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionsContextTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionsContextTest.cs (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; + +using Core.Common.Base.Geometry; + +using NUnit.Framework; + +using Rhino.Mocks; + +using Ringtoets.Common.Data; +using Ringtoets.Common.Forms.PresentationObjects; + +namespace Ringtoets.Common.Forms.Test.PresentationObjects +{ + [TestFixture] + public class FailureMechanismSectionsContextTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + IEnumerable sectionsSequence = new[] + { + new FailureMechanismSection("A", new[] + { + new Point2D(1, 2), + new Point2D(3, 4) + }), + new FailureMechanismSection("B", new[] + { + new Point2D(3, 4), + new Point2D(5, 6) + }) + }; + + var mocks = new MockRepository(); + var failureMechanism = mocks.Stub(); + failureMechanism.Stub(fm => fm.Sections).Return(sectionsSequence); + + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + // Call + var context = new FailureMechanismSectionsContext(failureMechanism, assessmentSection); + + // Assert + Assert.AreSame(sectionsSequence, context.WrappedData); + Assert.AreSame(failureMechanism, context.ParentFailureMechanism); + Assert.AreSame(assessmentSection, context.ParentAssessmentSection); + mocks.VerifyAll(); + } + + [Test] + public void Constructor_FailureMechanismNull_ThrowArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + // Call + TestDelegate call = () => new FailureMechanismSectionsContext(null, assessmentSection); + + // Assert + Assert.Throws(call); + mocks.VerifyAll(); + } + + [Test] + public void Constructor_AssessmentSectionNull_ThrowArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var failureMechanism = mocks.Stub(); + mocks.ReplayAll(); + + // Call + TestDelegate call = () => new FailureMechanismSectionsContext(failureMechanism, null); + + // Assert + Assert.Throws(call); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r69bae9f753011e0f962a3ffa9b3c696efe5852dd -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 69bae9f753011e0f962a3ffa9b3c696efe5852dd) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -57,6 +57,7 @@ + Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/Placeholders/FailureMechanismPlaceholder.cs =================================================================== diff -u -r337f02d824bf5352ed8148dbda0ca6b2b61a20c1 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/Placeholders/FailureMechanismPlaceholder.cs (.../FailureMechanismPlaceholder.cs) (revision 337f02d824bf5352ed8148dbda0ca6b2b61a20c1) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/Placeholders/FailureMechanismPlaceholder.cs (.../FailureMechanismPlaceholder.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -37,18 +37,12 @@ /// The placeholder's name. public FailureMechanismPlaceholder(string name) : base(name) { - SectionDivisions = new InputPlaceholder(RingtoetsCommonDataResources.FailureMechanism_SectionDevisions_DisplayName); Locations = new InputPlaceholder(RingtoetsCommonDataResources.FailureMechanism_Locations_DisplayName); BoundaryConditions = new InputPlaceholder(RingtoetsCommonDataResources.FailureMechanism_BoundaryConditions_DisplayName); AssessmentResult = new OutputPlaceholder(RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName); } /// - /// Gets the subdivision of the assessment section for which this failure mechanism is calculating. - /// - public InputPlaceholder SectionDivisions { get; private set; } - - /// /// Gets the locations relevant for evaluating this failure mechanism. /// public InputPlaceholder Locations { get; private set; } Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs =================================================================== diff -u -r7144ed9829e56a34e064267053216ffbcf6cff52 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 7144ed9829e56a34e064267053216ffbcf6cff52) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -47,6 +47,7 @@ using RingtoetsDataResources = Ringtoets.Integration.Data.Properties.Resources; using RingtoetsFormsResources = Ringtoets.Integration.Forms.Properties.Resources; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; using UtilsResources = Core.Common.Utils.Properties.Resources; using BaseResources = Core.Common.Base.Properties.Resources; @@ -152,6 +153,13 @@ ContextMenuStrip = FailureMechanismPlaceholderContextMenuStrip }; + yield return new TreeNodeInfo + { + Text = context => RingtoetsCommonDataResources.FailureMechanism_Sections_DisplayName, + Image = context => RingtoetsCommonFormsResources.Sections, + ContextMenuStrip = FailureMechanismSectionsContextMenuStrip + }; + yield return new TreeNodeInfo { Text = placeholderWithReadonlyName => placeholderWithReadonlyName.Name, @@ -270,19 +278,19 @@ return new object[] { new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Inputs_DisplayName, - GetInputs(nodeData.WrappedData), + GetInputs(nodeData.WrappedData, nodeData.Parent), TreeFolderCategory.Input), new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Outputs_DisplayName, GetOutputs(nodeData.WrappedData), TreeFolderCategory.Output) }; } - private IList GetInputs(FailureMechanismPlaceholder nodeData) + private IList GetInputs(FailureMechanismPlaceholder nodeData, AssessmentSectionBase assessmentSection) { return new ArrayList { - nodeData.SectionDivisions, + new FailureMechanismSectionsContext(nodeData, assessmentSection), nodeData.Locations, nodeData.BoundaryConditions }; @@ -331,6 +339,17 @@ # endregion + #region FailureMechanismSectionsContext + + private ContextMenuStrip FailureMechanismSectionsContextMenuStrip(FailureMechanismSectionsContext nodeData, object parentData, TreeViewControl treeViewControl) + { + return Gui.Get(nodeData, treeViewControl) + .AddImportItem() + .Build(); + } + + #endregion + # region PlaceholderWithReadonlyName private static Bitmap GetIconForPlaceholder(PlaceholderWithReadonlyName nodeData) Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Placeholders/FailureMechanismPlaceholderTest.cs =================================================================== diff -u -r0bfd1f4e2a179c8575045e5af70dce2930665626 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Placeholders/FailureMechanismPlaceholderTest.cs (.../FailureMechanismPlaceholderTest.cs) (revision 0bfd1f4e2a179c8575045e5af70dce2930665626) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Placeholders/FailureMechanismPlaceholderTest.cs (.../FailureMechanismPlaceholderTest.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -1,4 +1,6 @@ using NUnit.Framework; + +using Ringtoets.Common.Data; using Ringtoets.Integration.Data.Placeholders; namespace Ringtoets.Integration.Data.Test.Placeholders @@ -16,8 +18,9 @@ var failureMechanism = new FailureMechanismPlaceholder(expectedName); // Assert + Assert.IsInstanceOf(failureMechanism); Assert.AreEqual(expectedName, failureMechanism.Name); - Assert.AreEqual("Vakindeling", failureMechanism.SectionDivisions.Name); + CollectionAssert.IsEmpty(failureMechanism.Sections); Assert.AreEqual("Locaties", failureMechanism.Locations.Name); Assert.AreEqual("Randvoorwaarden", failureMechanism.BoundaryConditions.Name); Assert.AreEqual("Oordeel", failureMechanism.AssessmentResult.Name); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -r7144ed9829e56a34e064267053216ffbcf6cff52 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 7144ed9829e56a34e064267053216ffbcf6cff52) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -67,6 +67,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismPlaceholderTreeNodeInfoTest.cs =================================================================== diff -u -r7144ed9829e56a34e064267053216ffbcf6cff52 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismPlaceholderTreeNodeInfoTest.cs (.../FailureMechanismPlaceholderTreeNodeInfoTest.cs) (revision 7144ed9829e56a34e064267053216ffbcf6cff52) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismPlaceholderTreeNodeInfoTest.cs (.../FailureMechanismPlaceholderTreeNodeInfoTest.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -1,5 +1,7 @@ using System.Drawing; using System.Linq; + +using Core.Common.Base.Geometry; using Core.Common.Controls.TreeView; using Core.Common.Gui; using Core.Common.Gui.ContextMenu; @@ -105,6 +107,7 @@ mocks.ReplayAll(); var failureMechanism = new FailureMechanismPlaceholder("test"); + failureMechanism.AddSection(new FailureMechanismSection("A", new[]{ new Point2D(1,2), new Point2D(5,6) })); var failureMechanismContext = new FailureMechanismPlaceholderContext(failureMechanism, assessmentSection); // Call @@ -115,12 +118,16 @@ var inputFolder = (CategoryTreeFolder)children[0]; Assert.AreEqual("Invoer", inputFolder.Name); Assert.AreEqual(TreeFolderCategory.Input, inputFolder.Category); + + var failureMechanismSectionsContext = (FailureMechanismSectionsContext)inputFolder.Contents[0]; + CollectionAssert.AreEqual(failureMechanism.Sections, failureMechanismSectionsContext.WrappedData); + Assert.AreSame(failureMechanism, failureMechanismSectionsContext.ParentFailureMechanism); + Assert.AreSame(assessmentSection, failureMechanismSectionsContext.ParentAssessmentSection); CollectionAssert.AreEqual(new[] { - failureMechanism.SectionDivisions, failureMechanism.Locations, failureMechanism.BoundaryConditions - }, inputFolder.Contents); + }, inputFolder.Contents.Cast().Skip(1)); var outputFolder = (CategoryTreeFolder)children[1]; Assert.AreEqual("Uitvoer", outputFolder.Name); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismSectionsContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismSectionsContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismSectionsContextTreeNodeInfoTest.cs (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -0,0 +1,110 @@ +using System.Linq; + +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; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Integration.Plugin; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Forms.Test.TreeNodeInfos +{ + [TestFixture] + public class FailureMechanismSectionsContextTreeNodeInfoTest + { + private MockRepository mocks; + private RingtoetsGuiPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + plugin = new RingtoetsGuiPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionsContext)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(FailureMechanismSectionsContext), info.TagType); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.IsChecked); + Assert.IsNull(info.OnNodeChecked); + Assert.IsNull(info.CanDrag); + Assert.IsNull(info.CanDrop); + Assert.IsNull(info.CanInsert); + Assert.IsNull(info.OnDrop); + } + + [Test] + public void Text_Always_ReturnsName() + { + // Call + var text = info.Text(null); + + // Assert + Assert.AreEqual("Vakindeling", text); + } + + [Test] + public void Image_Always_ReturnSectionsIcon() + { + // Setup + + // Call + var image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.Sections, image); + } + + [Test] + public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() + { + // Setup + var treeViewControlMock = mocks.StrictMock(); + + var menuBuilderMock = mocks.StrictMock(); + menuBuilderMock.Expect(mb => mb.AddImportItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + + var failureMechanism = mocks.Stub(); + var assessmentSection = mocks.Stub(); + var context = new FailureMechanismSectionsContext(failureMechanism, assessmentSection); + + var gui = mocks.StrictMock(); + gui.Expect(cmp => cmp.Get(context, treeViewControlMock)).Return(menuBuilderMock); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(context, null, treeViewControlMock); + + // Assert + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs =================================================================== diff -u -r7144ed9829e56a34e064267053216ffbcf6cff52 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision 7144ed9829e56a34e064267053216ffbcf6cff52) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -13,8 +13,6 @@ using Ringtoets.Common.Data.Contribution; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Placeholder; -using Ringtoets.Integration.Data; -using Ringtoets.Integration.Data.Placeholders; using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.PropertyClasses; using Ringtoets.Integration.Forms.Views; @@ -109,12 +107,13 @@ TreeNodeInfo[] treeNodeInfos = guiPlugin.GetTreeNodeInfos().ToArray(); // assert - Assert.AreEqual(7, treeNodeInfos.Length); + Assert.AreEqual(8, treeNodeInfos.Length); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(AssessmentSectionBase))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ReferenceLineContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PlaceholderWithReadonlyName))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismPlaceholderContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(CategoryTreeFolder))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionsContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismContribution))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(HydraulicBoundaryDatabaseContext))); } Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs =================================================================== diff -u -r337f02d824bf5352ed8148dbda0ca6b2b61a20c1 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs (.../PipingFailureMechanism.cs) (revision 337f02d824bf5352ed8148dbda0ca6b2b61a20c1) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs (.../PipingFailureMechanism.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -38,7 +38,6 @@ /// public PipingFailureMechanism() : base(Resources.PipingFailureMechanism_DisplayName) { - SectionDivisions = new InputPlaceholder(RingtoetsCommonDataResources.FailureMechanism_SectionDevisions_DisplayName); SurfaceLines = new ObservableList(); SoilProfiles = new ObservableList(); BoundaryConditions = new InputPlaceholder(RingtoetsCommonDataResources.FailureMechanism_BoundaryConditions_DisplayName); @@ -49,11 +48,6 @@ } /// - /// Gets the subdivision of the assessment section for which the piping failure mechanism is calculating. - /// - public InputPlaceholder SectionDivisions { get; private set; } - - /// /// Gets the available within the scope of the piping failure mechanism. /// public ICollection SurfaceLines { get; private set; } Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs =================================================================== diff -u -r7318825b6005fa3a0050a906371604f54e0b19df -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 7318825b6005fa3a0050a906371604f54e0b19df) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -358,17 +358,17 @@ PipingFailureMechanism wrappedData = pipingFailureMechanismContext.WrappedData; return new object[] { - new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Inputs_DisplayName, GetInputs(wrappedData), TreeFolderCategory.Input), + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Inputs_DisplayName, GetInputs(wrappedData, pipingFailureMechanismContext.Parent), TreeFolderCategory.Input), new PipingCalculationGroupContext(wrappedData.CalculationsGroup, wrappedData.SurfaceLines, wrappedData.SoilProfiles, wrappedData, pipingFailureMechanismContext.Parent), new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Outputs_DisplayName, GetOutputs(wrappedData), TreeFolderCategory.Output) }; } - private static IList GetInputs(PipingFailureMechanism failureMechanism) + private static IList GetInputs(PipingFailureMechanism failureMechanism, AssessmentSectionBase assessmentSection) { return new ArrayList { - failureMechanism.SectionDivisions, + new FailureMechanismSectionsContext(failureMechanism, assessmentSection), failureMechanism.SurfaceLines, failureMechanism.SoilProfiles, failureMechanism.BoundaryConditions Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismTest.cs =================================================================== diff -u -reab6a10ef5444e79f4dddd5babbfcd5892d3d97a -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismTest.cs (.../PipingFailureMechanismTest.cs) (revision eab6a10ef5444e79f4dddd5babbfcd5892d3d97a) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismTest.cs (.../PipingFailureMechanismTest.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -26,8 +26,8 @@ var piping = new PipingFailureMechanism(); // assert - Assert.IsInstanceOf(piping); - Assert.AreEqual("Vakindeling", piping.SectionDivisions.Name); + Assert.IsInstanceOf(piping); + CollectionAssert.IsEmpty(piping.Sections); CollectionAssert.IsEmpty(piping.SurfaceLines); Assert.IsInstanceOf>(piping.SurfaceLines); CollectionAssert.IsEmpty(piping.SoilProfiles); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs =================================================================== diff -u -r7144ed9829e56a34e064267053216ffbcf6cff52 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs (.../PipingFailureMechanismTreeNodeInfoTest.cs) (revision 7144ed9829e56a34e064267053216ffbcf6cff52) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs (.../PipingFailureMechanismTreeNodeInfoTest.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -115,13 +115,18 @@ var inputsFolder = (CategoryTreeFolder) children[0]; Assert.AreEqual("Invoer", inputsFolder.Name); Assert.AreEqual(TreeFolderCategory.Input, inputsFolder.Category); + + var failureMechanismSectionsContext = (FailureMechanismSectionsContext)inputsFolder.Contents[0]; + CollectionAssert.AreEqual(pipingFailureMechanism.Sections, failureMechanismSectionsContext.WrappedData); + Assert.AreSame(pipingFailureMechanism, failureMechanismSectionsContext.ParentFailureMechanism); + Assert.AreSame(assessmentSection, failureMechanismSectionsContext.ParentAssessmentSection); + CollectionAssert.AreEqual(new object[] { - pipingFailureMechanism.SectionDivisions, pipingFailureMechanism.SurfaceLines, pipingFailureMechanism.SoilProfiles, pipingFailureMechanism.BoundaryConditions - }, inputsFolder.Contents); + }, inputsFolder.Contents.Cast().Skip(1)); var calculationsFolder = (PipingCalculationGroupContext) children[1]; Assert.AreEqual("Berekeningen", calculationsFolder.WrappedData.Name); Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs =================================================================== diff -u -radee25ed32a9e472ccce5fecb8a375d2cf1e4e26 -r76ace4042e4e8a92a0ba37e8e9a9373ed6cea951 --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision adee25ed32a9e472ccce5fecb8a375d2cf1e4e26) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision 76ace4042e4e8a92a0ba37e8e9a9373ed6cea951) @@ -9,6 +9,7 @@ using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; + using Ringtoets.Piping.Data; using Ringtoets.Piping.Forms.PresentationObjects; using Ringtoets.Piping.Forms.PropertyClasses;