Index: Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs =================================================================== diff -u -rb5f6de56734adc256e71ee5e487ac22d7217a6d4 -ref8604f650c1970196bc3081616f361f0236f266 --- Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision b5f6de56734adc256e71ee5e487ac22d7217a6d4) +++ Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision ef8604f650c1970196bc3081616f361f0236f266) @@ -424,6 +424,15 @@ .AddPropertiesItem() .Build() }; + + yield return new TreeNodeInfo + { + Text = context => RiskeerCommonFormsResources.CalculationOutput_DisplayName, + Image = context => RiskeerCommonFormsResources.OutputIcon, + ForeColor = context => context.WrappedData.HasOutput + ? Color.FromKnownColor(KnownColor.ControlText) + : Color.FromKnownColor(KnownColor.GrayText), + }; } #region ViewInfos Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PipingPluginTest.cs =================================================================== diff -u -rcd91a766d094b48e6d47a4ca91075185438aabb7 -ref8604f650c1970196bc3081616f361f0236f266 --- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PipingPluginTest.cs (.../PipingPluginTest.cs) (revision cd91a766d094b48e6d47a4ca91075185438aabb7) +++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PipingPluginTest.cs (.../PipingPluginTest.cs) (revision ef8604f650c1970196bc3081616f361f0236f266) @@ -138,7 +138,7 @@ TreeNodeInfo[] treeNodeInfos = plugin.GetTreeNodeInfos().ToArray(); // Assert - Assert.AreEqual(15, treeNodeInfos.Length); + Assert.AreEqual(16, 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))); @@ -154,6 +154,7 @@ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(EmptySemiProbabilisticPipingOutput))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilisticPipingCalculationContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilisticPipingInputContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ProbabilisticPipingOutputContext))); } } Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/Probabilistic/ProbabilisticPipingOutputContextTreeNodeInfoTest.cs =================================================================== diff -u --- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/Probabilistic/ProbabilisticPipingOutputContextTreeNodeInfoTest.cs (revision 0) +++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/Probabilistic/ProbabilisticPipingOutputContextTreeNodeInfoTest.cs (revision ef8604f650c1970196bc3081616f361f0236f266) @@ -0,0 +1,129 @@ +// 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.TestUtil; +using NUnit.Framework; +using Riskeer.Piping.Data; +using Riskeer.Piping.Data.Probabilistic; +using Riskeer.Piping.Data.TestUtil; +using Riskeer.Piping.Forms.PresentationObjects.Probabilistic; +using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources; + +namespace Riskeer.Piping.Plugin.Test.TreeNodeInfos.Probabilistic +{ + [TestFixture] + public class ProbabilisticPipingOutputContextTreeNodeInfoTest + { + private PipingPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + plugin = new PipingPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ProbabilisticPipingOutputContext)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.IsNotNull(info.Text); + Assert.IsNotNull(info.ForeColor); + Assert.IsNotNull(info.Image); + Assert.IsNull(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_ReturnsFromResource() + { + // Call + string text = info.Text(null); + + // Assert + Assert.AreEqual("Resultaat", text); + } + + [Test] + public void ForeColor_HasNoOutput_ReturnGrayText() + { + // Setup + var context = new ProbabilisticPipingOutputContext(new ProbabilisticPipingCalculation(new GeneralPipingInput())); + + // Call + Color color = info.ForeColor(context); + + // Assert + Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); + } + + [Test] + public void ForeColor_HasOutput_ReturnControlText() + { + // Setup + var calculation = new ProbabilisticPipingCalculation(new GeneralPipingInput()) + { + Output = PipingTestDataGenerator.GetRandomProbabilisticPipingOutput() + }; + + var context = new ProbabilisticPipingOutputContext(calculation); + + // Call + Color color = info.ForeColor(context); + + // Assert + Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color); + } + + [Test] + public void Image_Always_ReturnsGeneralOutputIcon() + { + // Call + Image image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.OutputIcon, image); + } + } +} \ No newline at end of file