Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismResultView.cs =================================================================== diff -u -rcbe303fbc7bcf3a77b34d511eb2b41f49b48e67c -r06e9744ea1ecb91f6376cd3c89ab6ebe1b8fde0c --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismResultView.cs (.../PipingFailureMechanismResultView.cs) (revision cbe303fbc7bcf3a77b34d511eb2b41f49b48e67c) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismResultView.cs (.../PipingFailureMechanismResultView.cs) (revision 06e9744ea1ecb91f6376cd3c89ab6ebe1b8fde0c) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using Core.Common.Controls.Views; @@ -28,11 +29,11 @@ namespace Ringtoets.Piping.Forms.Views { /// - /// The view for the . + /// The view for the . /// public partial class PipingFailureMechanismResultView : UserControl, IView { - private PipingFailureMechanismSectionResult pipingFailureMechanismSectionResult; + private List pipingFailureMechanismSectionResult; /// /// Creates a new instance of . @@ -98,7 +99,7 @@ } set { - pipingFailureMechanismSectionResult = value as PipingFailureMechanismSectionResult; + pipingFailureMechanismSectionResult = value as List; } } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs =================================================================== diff -u -rcbe303fbc7bcf3a77b34d511eb2b41f49b48e67c -r06e9744ea1ecb91f6376cd3c89ab6ebe1b8fde0c --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision cbe303fbc7bcf3a77b34d511eb2b41f49b48e67c) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 06e9744ea1ecb91f6376cd3c89ab6ebe1b8fde0c) @@ -254,7 +254,10 @@ yield return new TreeNodeInfo> { Text = context => RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName, - Image = context => RingtoetsCommonFormsResources.GenericInputOutputIcon + Image = context => RingtoetsCommonFormsResources.GenericInputOutputIcon, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .Build() }; } Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj =================================================================== diff -u -rcbe303fbc7bcf3a77b34d511eb2b41f49b48e67c -r06e9744ea1ecb91f6376cd3c89ab6ebe1b8fde0c --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision cbe303fbc7bcf3a77b34d511eb2b41f49b48e67c) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 06e9744ea1ecb91f6376cd3c89ab6ebe1b8fde0c) @@ -69,7 +69,7 @@ - + Fisheye: Tag 06e9744ea1ecb91f6376cd3c89ab6ebe1b8fde0c refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismResultContextTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismSectionResultTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismSectionResultTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismSectionResultTreeNodeInfoTest.cs (revision 06e9744ea1ecb91f6376cd3c89ab6ebe1b8fde0c) @@ -0,0 +1,121 @@ +// 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.Collections.Generic; +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.Piping.Data; +using Ringtoets.Piping.Plugin; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Piping.Forms.Test.TreeNodeInfos +{ + [TestFixture] + public class PipingFailureMechanismSectionResultTreeNodeInfoTest + { + private MockRepository mocks; + private PipingGuiPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + plugin = new PipingGuiPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(List)); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(List), info.TagType); + Assert.IsNull(info.ForeColor); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + 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() + { + // Setup + mocks.ReplayAll(); + + var mechanism = new PipingFailureMechanism(); + + // Call + var text = info.Text(mechanism.PipingFailureMechanismSectionResults); + + // Assert + Assert.AreEqual("Oordeel", text); + mocks.VerifyAll(); + } + + [Test] + public void Image_Always_ReturnsGenericInputOutputIcon() + { + // Call + var image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image); + } + + [Test] + public void ContextMenuStrip_Always_CallsBuilder() + { + // Setup + var gui = mocks.StrictMultiMock(); + var treeViewControl = mocks.StrictMock(); + var menuBuilderMock = mocks.StrictMock(); + + gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); + + menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(null, null, treeViewControl); + + // Assert + mocks.VerifyAll(); + } + } +} \ No newline at end of file