Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PresentationObjects/ClosingStructuresFailureMechanismSectionResultContext.cs =================================================================== diff -u --- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PresentationObjects/ClosingStructuresFailureMechanismSectionResultContext.cs (revision 0) +++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PresentationObjects/ClosingStructuresFailureMechanismSectionResultContext.cs (revision 178fab2d2a5ab440ee635d65ebd28eac5b2f8416) @@ -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.ClosingStructures.Data; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.FailureMechanism; +using Riskeer.Common.Forms.PresentationObjects; + +namespace Riskeer.ClosingStructures.Forms.PresentationObjects +{ + /// + /// This class is a presentation object for a collection of + /// for the . + /// + public class ClosingStructuresFailureMechanismSectionResultContext : 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 ClosingStructuresFailureMechanismSectionResultContext(IObservableEnumerable wrappedSectionResults, + ClosingStructuresFailureMechanism failureMechanism, IAssessmentSection assessmentSection) + : base(wrappedSectionResults, failureMechanism, assessmentSection) {} + } +} \ No newline at end of file Fisheye: Tag 178fab2d2a5ab440ee635d65ebd28eac5b2f8416 refers to a dead (removed) revision in file `Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PresentationObjects/ClosingStructuresProbabilityFailureMechanismSectionResultContext.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Plugin/ClosingStructuresPlugin.cs =================================================================== diff -u -r09fda91ef087b3955cdc6eb758901340b72ee4db -r178fab2d2a5ab440ee635d65ebd28eac5b2f8416 --- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Plugin/ClosingStructuresPlugin.cs (.../ClosingStructuresPlugin.cs) (revision 09fda91ef087b3955cdc6eb758901340b72ee4db) +++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Plugin/ClosingStructuresPlugin.cs (.../ClosingStructuresPlugin.cs) (revision 178fab2d2a5ab440ee635d65ebd28eac5b2f8416) @@ -110,7 +110,7 @@ }; yield return new RiskeerViewInfo< - ClosingStructuresProbabilityFailureMechanismSectionResultContext, + ClosingStructuresFailureMechanismSectionResultContext, IObservableEnumerable, StructuresFailureMechanismResultView>(() => Gui) { @@ -163,7 +163,7 @@ CalculationContextOnNodeRemoved, CalculationType.Probabilistic); - yield return new TreeNodeInfo + yield return new TreeNodeInfo { Text = context => RiskeerCommonFormsResources.FailureMechanism_AssessmentResult_DisplayName, Image = context => RiskeerCommonFormsResources.FailureMechanismSectionResultIcon, @@ -477,7 +477,7 @@ return new object[] { new ClosingStructuresScenariosContext(failureMechanism.CalculationsGroup, failureMechanism), - new ClosingStructuresProbabilityFailureMechanismSectionResultContext( + new ClosingStructuresFailureMechanismSectionResultContext( failureMechanism.SectionResults, failureMechanism, assessmentSection), failureMechanism.InAssemblyOutputComments }; Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresFailureMechanismSectionResultContextTest.cs =================================================================== diff -u --- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresFailureMechanismSectionResultContextTest.cs (revision 0) +++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresFailureMechanismSectionResultContextTest.cs (revision 178fab2d2a5ab440ee635d65ebd28eac5b2f8416) @@ -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.ClosingStructures.Data; +using Riskeer.ClosingStructures.Forms.PresentationObjects; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.FailureMechanism; +using Riskeer.Common.Forms.PresentationObjects; + +namespace Riskeer.ClosingStructures.Forms.Test.PresentationObjects +{ + [TestFixture] + public class ClosingStructuresFailureMechanismSectionResultContextTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new ClosingStructuresFailureMechanism(); + + // Call + var context = new ClosingStructuresFailureMechanismSectionResultContext( + failureMechanism.SectionResults, failureMechanism, assessmentSection); + + // Assert + Assert.IsInstanceOf>(context); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Fisheye: Tag 178fab2d2a5ab440ee635d65ebd28eac5b2f8416 refers to a dead (removed) revision in file `Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresProbabilityFailureMechanismSectionResultContextTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ClosingStructuresPluginTest.cs =================================================================== diff -u -rac91f4c76f9152b0041f684d2b38c9a5ae49d069 -r178fab2d2a5ab440ee635d65ebd28eac5b2f8416 --- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ClosingStructuresPluginTest.cs (.../ClosingStructuresPluginTest.cs) (revision ac91f4c76f9152b0041f684d2b38c9a5ae49d069) +++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ClosingStructuresPluginTest.cs (.../ClosingStructuresPluginTest.cs) (revision 178fab2d2a5ab440ee635d65ebd28eac5b2f8416) @@ -107,7 +107,7 @@ Assert.AreEqual(9, treeNodeInfos.Length); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ClosingStructuresCalculationsContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ClosingStructuresFailurePathContext))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ClosingStructuresProbabilityFailureMechanismSectionResultContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ClosingStructuresFailureMechanismSectionResultContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ClosingStructuresContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ClosingStructure))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ClosingStructuresCalculationGroupContext))); @@ -152,7 +152,7 @@ PluginTestHelper.AssertViewInfoDefined( viewInfos, - typeof(ClosingStructuresProbabilityFailureMechanismSectionResultContext), + typeof(ClosingStructuresFailureMechanismSectionResultContext), typeof(IObservableEnumerable), typeof(StructuresFailureMechanismResultView)); Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u --- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 0) +++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 178fab2d2a5ab440ee635d65ebd28eac5b2f8416) @@ -0,0 +1,126 @@ +// 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.ClosingStructures.Forms.PresentationObjects; +using Riskeer.Common.Forms.Properties; + +namespace Riskeer.ClosingStructures.Plugin.Test.TreeNodeInfos +{ + [TestFixture] + public class ClosingStructuresFailureMechanismSectionResultContextTreeNodeInfoTest + { + private ClosingStructuresPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void Setup() + { + plugin = new ClosingStructuresPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ClosingStructuresFailureMechanismSectionResultContext)); + } + + [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(Resources.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); + gui.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(null, null, treeViewControl); + } + + // Assert + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresFailurePathContextTreeNodeInfoTest.cs =================================================================== diff -u -r09fda91ef087b3955cdc6eb758901340b72ee4db -r178fab2d2a5ab440ee635d65ebd28eac5b2f8416 --- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresFailurePathContextTreeNodeInfoTest.cs (.../ClosingStructuresFailurePathContextTreeNodeInfoTest.cs) (revision 09fda91ef087b3955cdc6eb758901340b72ee4db) +++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresFailurePathContextTreeNodeInfoTest.cs (.../ClosingStructuresFailurePathContextTreeNodeInfoTest.cs) (revision 178fab2d2a5ab440ee635d65ebd28eac5b2f8416) @@ -144,7 +144,7 @@ Assert.AreSame(failureMechanism, scenariosContext.ParentFailureMechanism); Assert.AreSame(failureMechanism.CalculationsGroup, scenariosContext.WrappedData); - var failureMechanismResultsContext = (ClosingStructuresProbabilityFailureMechanismSectionResultContext) outputsFolder.Contents.ElementAt(1); + var failureMechanismResultsContext = (ClosingStructuresFailureMechanismSectionResultContext) outputsFolder.Contents.ElementAt(1); Assert.AreSame(failureMechanism, failureMechanismResultsContext.FailureMechanism); Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); Assert.AreSame(assessmentSection, failureMechanismResultsContext.AssessmentSection); Fisheye: Tag 178fab2d2a5ab440ee635d65ebd28eac5b2f8416 refers to a dead (removed) revision in file `Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresFailureMechanismResultViewInfoTest.cs =================================================================== diff -u -rd5057ee878545d62057b1ac279a987056440ba70 -r178fab2d2a5ab440ee635d65ebd28eac5b2f8416 --- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresFailureMechanismResultViewInfoTest.cs (.../ClosingStructuresFailureMechanismResultViewInfoTest.cs) (revision d5057ee878545d62057b1ac279a987056440ba70) +++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresFailureMechanismResultViewInfoTest.cs (.../ClosingStructuresFailureMechanismResultViewInfoTest.cs) (revision 178fab2d2a5ab440ee635d65ebd28eac5b2f8416) @@ -59,7 +59,7 @@ public void Initialized_Always_ExpectedPropertiesSet() { // Assert - Assert.AreEqual(typeof(ClosingStructuresProbabilityFailureMechanismSectionResultContext), info.DataType); + Assert.AreEqual(typeof(ClosingStructuresFailureMechanismSectionResultContext), info.DataType); Assert.AreEqual(typeof(IObservableEnumerable), info.ViewDataType); } @@ -82,7 +82,7 @@ var failureMechanism = new ClosingStructuresFailureMechanism(); - var context = new ClosingStructuresProbabilityFailureMechanismSectionResultContext( + var context = new ClosingStructuresFailureMechanismSectionResultContext( failureMechanism.SectionResults, failureMechanism, assessmentSection); // Call @@ -266,7 +266,7 @@ var failureMechanism = new ClosingStructuresFailureMechanism(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mocks); - var context = new ClosingStructuresProbabilityFailureMechanismSectionResultContext( + var context = new ClosingStructuresFailureMechanismSectionResultContext( failureMechanism.SectionResults, failureMechanism, assessmentSection);