Index: Riskeer/Piping/src/Riskeer.Piping.Forms/PresentationObjects/PipingFailureMechanismSectionResultContext.cs =================================================================== diff -u --- Riskeer/Piping/src/Riskeer.Piping.Forms/PresentationObjects/PipingFailureMechanismSectionResultContext.cs (revision 0) +++ Riskeer/Piping/src/Riskeer.Piping.Forms/PresentationObjects/PipingFailureMechanismSectionResultContext.cs (revision 52b09d69bfafc817e8f1e93aa8f2b1f772cf7840) @@ -0,0 +1,50 @@ +// Copyright (C) Stichting Deltares 2021. 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; +using Core.Common.Base; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.FailureMechanism; +using Riskeer.Common.Forms.PresentationObjects; +using Riskeer.Piping.Data; + +namespace Riskeer.Piping.Forms.PresentationObjects +{ + /// + /// This class is a presentation object for a collection of + /// for the . + /// + public class PipingFailureMechanismSectionResultContext : FailureMechanismSectionResultContext + { + /// + /// Creates a new instance of . + /// + /// The + /// of to wrap. + /// The + /// the belongs to. + /// The assessment section the section results belongs to. + /// Thrown when any parameter is null. + public PipingFailureMechanismSectionResultContext(IObservableEnumerable wrappedSectionResults, + PipingFailureMechanism failureMechanism, IAssessmentSection assessmentSection) + : base(wrappedSectionResults, failureMechanism, assessmentSection) {} + } +} \ No newline at end of file Fisheye: Tag 52b09d69bfafc817e8f1e93aa8f2b1f772cf7840 refers to a dead (removed) revision in file `Riskeer/Piping/src/Riskeer.Piping.Forms/PresentationObjects/PipingProbabilityFailureMechanismSectionResultContext.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs =================================================================== diff -u -r09fda91ef087b3955cdc6eb758901340b72ee4db -r52b09d69bfafc817e8f1e93aa8f2b1f772cf7840 --- Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 09fda91ef087b3955cdc6eb758901340b72ee4db) +++ Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 52b09d69bfafc817e8f1e93aa8f2b1f772cf7840) @@ -257,7 +257,7 @@ }; yield return new RiskeerViewInfo< - PipingProbabilityFailureMechanismSectionResultContext, + PipingFailureMechanismSectionResultContext, IObservableEnumerable, PipingFailureMechanismResultView>(() => Gui) { @@ -394,7 +394,7 @@ CalculationGroupContextContextMenuStrip, CalculationGroupContextOnNodeRemoved); - yield return new TreeNodeInfo + yield return new TreeNodeInfo { Text = context => RiskeerCommonFormsResources.FailureMechanism_AssessmentResult_DisplayName, Image = context => RiskeerCommonFormsResources.FailureMechanismSectionResultIcon, @@ -882,7 +882,7 @@ return new object[] { new PipingScenariosContext(failureMechanism.CalculationsGroup, failureMechanism, assessmentSection), - new PipingProbabilityFailureMechanismSectionResultContext( + new PipingFailureMechanismSectionResultContext( failureMechanism.SectionResults, failureMechanism, assessmentSection), failureMechanism.InAssemblyOutputComments }; Index: Riskeer/Piping/test/Riskeer.Piping.Forms.Test/PresentationObjects/PipingFailureMechanismSectionResultContextTest.cs =================================================================== diff -u --- Riskeer/Piping/test/Riskeer.Piping.Forms.Test/PresentationObjects/PipingFailureMechanismSectionResultContextTest.cs (revision 0) +++ Riskeer/Piping/test/Riskeer.Piping.Forms.Test/PresentationObjects/PipingFailureMechanismSectionResultContextTest.cs (revision 52b09d69bfafc817e8f1e93aa8f2b1f772cf7840) @@ -0,0 +1,54 @@ +// Copyright (C) Stichting Deltares 2021. 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 NUnit.Framework; +using Rhino.Mocks; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.FailureMechanism; +using Riskeer.Common.Forms.PresentationObjects; +using Riskeer.Piping.Data; +using Riskeer.Piping.Forms.PresentationObjects; + +namespace Riskeer.Piping.Forms.Test.PresentationObjects +{ + [TestFixture] + public class PipingFailureMechanismSectionResultContextTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new PipingFailureMechanism(); + + // Call + var context = new PipingFailureMechanismSectionResultContext( + failureMechanism.SectionResults, failureMechanism, assessmentSection); + + // Assert + Assert.IsInstanceOf>(context); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Fisheye: Tag 52b09d69bfafc817e8f1e93aa8f2b1f772cf7840 refers to a dead (removed) revision in file `Riskeer/Piping/test/Riskeer.Piping.Forms.Test/PresentationObjects/PipingProbabilityFailureMechanismSectionResultContextTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PipingPluginTest.cs =================================================================== diff -u -r1a74cf8870ea2f43e667b624b90347a5a3b71704 -r52b09d69bfafc817e8f1e93aa8f2b1f772cf7840 --- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PipingPluginTest.cs (.../PipingPluginTest.cs) (revision 1a74cf8870ea2f43e667b624b90347a5a3b71704) +++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/PipingPluginTest.cs (.../PipingPluginTest.cs) (revision 52b09d69bfafc817e8f1e93aa8f2b1f772cf7840) @@ -165,7 +165,7 @@ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(SemiProbabilisticPipingCalculationScenarioContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingCalculationGroupContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(SemiProbabilisticPipingInputContext))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingProbabilityFailureMechanismSectionResultContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingFailureMechanismSectionResultContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(SemiProbabilisticPipingOutputContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingScenariosContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(EmptySemiProbabilisticPipingOutput))); @@ -213,7 +213,7 @@ PluginTestHelper.AssertViewInfoDefined( viewInfos, - typeof(PipingProbabilityFailureMechanismSectionResultContext), + typeof(PipingFailureMechanismSectionResultContext), typeof(IObservableEnumerable), typeof(PipingFailureMechanismResultView)); Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/PipingFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u --- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/PipingFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 0) +++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/PipingFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 52b09d69bfafc817e8f1e93aa8f2b1f772cf7840) @@ -0,0 +1,124 @@ +// Copyright (C) Stichting Deltares 2021. 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 Core.Gui; +using Core.Gui.ContextMenu; +using NUnit.Framework; +using Rhino.Mocks; +using Riskeer.Piping.Forms.PresentationObjects; +using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources; + +namespace Riskeer.Piping.Plugin.Test.TreeNodeInfos +{ + [TestFixture] + public class PipingFailureMechanismSectionResultContextTreeNodeInfoTest + { + private PipingPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + plugin = new PipingPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(PipingFailureMechanismSectionResultContext)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // 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_ReturnsName() + { + // Call + string text = info.Text(null); + + // Assert + Assert.AreEqual("Resultaat", text); + } + + [Test] + public void Image_Always_ReturnsFailureMechanismSectionResultIcon() + { + // Call + Image image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.FailureMechanismSectionResultIcon, image); + } + + [Test] + public void ContextMenuStrip_Always_CallsBuilder() + { + // Setup + var mocks = new MockRepository(); + var menuBuilder = mocks.StrictMock(); + menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.Build()).Return(null); + + using (var treeViewControl = new TreeViewControl()) + { + var gui = mocks.Stub(); + gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(null, null, treeViewControl); + } + + // Assert + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/PipingFailurePathContextTreeNodeInfoTest.cs =================================================================== diff -u -r09fda91ef087b3955cdc6eb758901340b72ee4db -r52b09d69bfafc817e8f1e93aa8f2b1f772cf7840 --- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/PipingFailurePathContextTreeNodeInfoTest.cs (.../PipingFailurePathContextTreeNodeInfoTest.cs) (revision 09fda91ef087b3955cdc6eb758901340b72ee4db) +++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/PipingFailurePathContextTreeNodeInfoTest.cs (.../PipingFailurePathContextTreeNodeInfoTest.cs) (revision 52b09d69bfafc817e8f1e93aa8f2b1f772cf7840) @@ -145,7 +145,7 @@ Assert.AreSame(failureMechanism.CalculationsGroup, failureMechanismScenariosContext.WrappedData); Assert.AreSame(assessmentSection, failureMechanismScenariosContext.AssessmentSection); - var failureMechanismResultsContext = (PipingProbabilityFailureMechanismSectionResultContext) outputsFolder.Contents.ElementAt(1); + var failureMechanismResultsContext = (PipingFailureMechanismSectionResultContext) outputsFolder.Contents.ElementAt(1); Assert.AreSame(failureMechanism, failureMechanismResultsContext.FailureMechanism); Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); Assert.AreSame(assessmentSection, failureMechanismResultsContext.AssessmentSection); Fisheye: Tag 52b09d69bfafc817e8f1e93aa8f2b1f772cf7840 refers to a dead (removed) revision in file `Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/PipingProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismResultViewInfoTest.cs =================================================================== diff -u -r1a74cf8870ea2f43e667b624b90347a5a3b71704 -r52b09d69bfafc817e8f1e93aa8f2b1f772cf7840 --- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismResultViewInfoTest.cs (.../PipingFailureMechanismResultViewInfoTest.cs) (revision 1a74cf8870ea2f43e667b624b90347a5a3b71704) +++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismResultViewInfoTest.cs (.../PipingFailureMechanismResultViewInfoTest.cs) (revision 52b09d69bfafc817e8f1e93aa8f2b1f772cf7840) @@ -60,7 +60,7 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Assert - Assert.AreEqual(typeof(PipingProbabilityFailureMechanismSectionResultContext), info.DataType); + Assert.AreEqual(typeof(PipingFailureMechanismSectionResultContext), info.DataType); Assert.AreEqual(typeof(IObservableEnumerable), info.ViewDataType); } @@ -72,7 +72,7 @@ IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mocks); mocks.ReplayAll(); - var context = new PipingProbabilityFailureMechanismSectionResultContext( + var context = new PipingFailureMechanismSectionResultContext( failureMechanism.SectionResults, failureMechanism, assessmentSection); // Call @@ -265,7 +265,7 @@ IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mocks); mocks.ReplayAll(); - var context = new PipingProbabilityFailureMechanismSectionResultContext( + var context = new PipingFailureMechanismSectionResultContext( failureMechanism.SectionResults, failureMechanism, assessmentSection); // Call