Index: Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs =================================================================== diff -u -r3c9a54979d1600feca2e1ace19deca3947b1e7c0 -rb6c574cf6bc779c216c06ff5d214e453183ff100 --- Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 3c9a54979d1600feca2e1ace19deca3947b1e7c0) +++ Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision b6c574cf6bc779c216c06ff5d214e453183ff100) @@ -315,6 +315,17 @@ .AddPropertiesItem() .Build() }; + + yield return new TreeNodeInfo + { + Text = pipingInputContext => RiskeerCommonFormsResources.Calculation_Input, + Image = pipingInputContext => PipingFormsResources.PipingInputIcon, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .AddSeparator() + .AddPropertiesItem() + .Build() + }; yield return new TreeNodeInfo { Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PipingPluginTest.cs =================================================================== diff -u -rf5ffb52fc4c01ab2809d0c662a4e52a10f9307c7 -rb6c574cf6bc779c216c06ff5d214e453183ff100 --- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PipingPluginTest.cs (.../PipingPluginTest.cs) (revision f5ffb52fc4c01ab2809d0c662a4e52a10f9307c7) +++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PipingPluginTest.cs (.../PipingPluginTest.cs) (revision b6c574cf6bc779c216c06ff5d214e453183ff100) @@ -128,21 +128,22 @@ TreeNodeInfo[] treeNodeInfos = plugin.GetTreeNodeInfos().ToArray(); // Assert - Assert.AreEqual(14, treeNodeInfos.Length); + Assert.AreEqual(15, treeNodeInfos.Length); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingSurfaceLinesContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingSurfaceLine))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingStochasticSoilModelCollectionContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingStochasticSoilModel))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingStochasticSoilProfile))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingCalculationScenarioContext))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilisticPipingCalculationContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingCalculationGroupContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingInputContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingFailureMechanismContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilityFailureMechanismSectionResultContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingOutputContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingScenariosContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(EmptyPipingOutput))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilisticPipingCalculationContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilisticPipingInputContext))); } } Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/ProbabilisticPipingInputContextTreeNodeInfoTest.cs =================================================================== diff -u --- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/ProbabilisticPipingInputContextTreeNodeInfoTest.cs (revision 0) +++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/ProbabilisticPipingInputContextTreeNodeInfoTest.cs (revision b6c574cf6bc779c216c06ff5d214e453183ff100) @@ -0,0 +1,157 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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 Riskeer.Common.Data.AssessmentSection; +using Riskeer.Piping.Data; +using Riskeer.Piping.Data.SoilProfile; +using Riskeer.Piping.Forms.PresentationObjects; +using Riskeer.Piping.Forms.Properties; +using Riskeer.Piping.Primitives; + +namespace Riskeer.Piping.Plugin.Test.TreeNodeInfos +{ + [TestFixture] + public class ProbabilisticPipingInputContextTreeNodeInfoTest + { + private MockRepository mocks; + private PipingPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + plugin = new PipingPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilisticPipingInputContext)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + mocks.ReplayAll(); + + // Assert + Assert.IsNotNull(info.Text); + Assert.IsNull(info.ForeColor); + Assert.IsNotNull(info.Image); + Assert.IsNotNull(info.ContextMenuStrip); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.ExpandOnCreate); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.CheckedState); + 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_ReturnsTextFromResource() + { + // Setup + var pipingInputContext = new ProbabilisticPipingInputContext( + new ProbabilisticPipingInput(new GeneralPipingInput()), + new ProbabilisticPipingCalculation(new GeneralPipingInput()), + Enumerable.Empty(), + Enumerable.Empty(), + new PipingFailureMechanism(), + mocks.Stub()); + + mocks.ReplayAll(); + + // Call + string text = info.Text(pipingInputContext); + + // Assert + Assert.AreEqual("Invoer", text); + } + + [Test] + public void Image_Always_ReturnsSetImage() + { + // Setup + var pipingInputContext = new ProbabilisticPipingInputContext( + new ProbabilisticPipingInput(new GeneralPipingInput()), + new ProbabilisticPipingCalculation(new GeneralPipingInput()), + Enumerable.Empty(), + Enumerable.Empty(), + new PipingFailureMechanism(), + mocks.Stub()); + + mocks.ReplayAll(); + + // Call + Image image = info.Image(pipingInputContext); + + // Assert + TestHelper.AssertImagesAreEqual(Resources.PipingInputIcon, image); + } + + [Test] + public void ContextMenuStrip_Always_CallsBuilder() + { + // Setup + var gui = mocks.Stub(); + var menuBuilder = mocks.StrictMock(); + + menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.Build()).Return(null); + + using (var treeViewControl = new TreeViewControl()) + { + gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder); + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(null, null, treeViewControl); + } + + // Assert + // Assert expectancies are called in TearDown() + } + } +} \ No newline at end of file