Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs =================================================================== diff -u -rcc5cf56500e72070752f8daa5293d46c2757134e -r2336e45e063aee566b1fa028efed72d531cdf5ee --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision cc5cf56500e72070752f8daa5293d46c2757134e) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision 2336e45e063aee566b1fa028efed72d531cdf5ee) @@ -114,6 +114,15 @@ .Build() }; + yield return new TreeNodeInfo + { + Text = emptyPipingOutput => RingtoetsCommonFormsResources.CalculationOutput_DisplayName, + Image = emptyPipingOutput => RingtoetsCommonFormsResources.GeneralOutputIcon, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddPropertiesItem() + .Build() + }; + yield return new TreeNodeInfo> { Text = context => RingtoetsCommonFormsResources.FailureMechanism_AssessmentResult_DisplayName, Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Ringtoets.StabilityStoneCover.Forms.Test.csproj =================================================================== diff -u -r6b330f8e7c1df6bc70f6de1e4251f69cd6865a81 -r2336e45e063aee566b1fa028efed72d531cdf5ee --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Ringtoets.StabilityStoneCover.Forms.Test.csproj (.../Ringtoets.StabilityStoneCover.Forms.Test.csproj) (revision 6b330f8e7c1df6bc70f6de1e4251f69cd6865a81) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Ringtoets.StabilityStoneCover.Forms.Test.csproj (.../Ringtoets.StabilityStoneCover.Forms.Test.csproj) (revision 2336e45e063aee566b1fa028efed72d531cdf5ee) @@ -82,6 +82,7 @@ + Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsOutputTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsOutputTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsOutputTreeNodeInfoTest.cs (revision 2336e45e063aee566b1fa028efed72d531cdf5ee) @@ -0,0 +1,141 @@ +// 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.Drawing; +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.Revetment.Data; +using Ringtoets.StabilityStoneCover.Data; +using Ringtoets.StabilityStoneCover.Plugin; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.StabilityStoneCover.Forms.Test.TreeNodeInfos +{ + [TestFixture] + public class StabilityStoneCoverWaveConditionsOutputTreeNodeInfoTest + { + private MockRepository mocks; + private StabilityStoneCoverPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + plugin = new StabilityStoneCoverPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(StabilityStoneCoverWaveConditionsOutput)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + mocks.ReplayAll(); + + // Assert + Assert.AreEqual(typeof(StabilityStoneCoverWaveConditionsOutput), 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.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); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.ForeColor); + } + + [Test] + public void Text_Always_ReturnName() + { + // Setup + mocks.ReplayAll(); + + var output = new StabilityStoneCoverWaveConditionsOutput(Enumerable.Empty(), Enumerable.Empty()); + + // Call + string nodeText = info.Text(output); + + // Assert + Assert.AreEqual("Resultaat", nodeText); + } + + [Test] + public void Image_Always_ReturnOutputIcon() + { + // Setup + mocks.ReplayAll(); + + var output = new StabilityStoneCoverWaveConditionsOutput(Enumerable.Empty(), Enumerable.Empty()); + + // Call + Image icon = info.Image(output); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GeneralOutputIcon, icon); + } + + [Test] + public void ContextMenuStrip_FailureMechanismIsRelevant_CallsContextMenuBuilderMethods() + { + // Setup + using (var treeViewControl = new TreeViewControl()) + { + var output = new StabilityStoneCoverWaveConditionsOutput(Enumerable.Empty(), Enumerable.Empty()); + + var menuBuilder = mocks.StrictMock(); + menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.Build()).Return(null); + + var gui = mocks.StrictMock(); + gui.Expect(cmp => cmp.Get(output, treeViewControl)).Return(menuBuilder); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(output, null, treeViewControl); + } + + // Assert + // Assert expectancies are called in TearDown() + } + } +} \ No newline at end of file Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/StabilityStoneCoverPluginTest.cs =================================================================== diff -u -r0d98073e4ba2bdc6b69b7f875508488d1fa0148a -r2336e45e063aee566b1fa028efed72d531cdf5ee --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/StabilityStoneCoverPluginTest.cs (.../StabilityStoneCoverPluginTest.cs) (revision 0d98073e4ba2bdc6b69b7f875508488d1fa0148a) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/StabilityStoneCoverPluginTest.cs (.../StabilityStoneCoverPluginTest.cs) (revision 2336e45e063aee566b1fa028efed72d531cdf5ee) @@ -85,13 +85,14 @@ TreeNodeInfo[] treeNodeInfos = plugin.GetTreeNodeInfos().ToArray(); // Assert - Assert.AreEqual(6, treeNodeInfos.Length); + Assert.AreEqual(7, treeNodeInfos.Length); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityStoneCoverFailureMechanismContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityStoneCoverWaveConditionsCalculationGroupContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityStoneCoverWaveConditionsCalculationContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityStoneCoverWaveConditionsCalculationInputContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(EmptyStabilityStoneCoverOutput))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StabilityStoneCoverWaveConditionsOutput))); } } }