Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj
===================================================================
diff -u -r79f417a64ad7845136da14dc776b14503797347e -r3b29807e8903b2cea3ee7a00a59b2b50f9de1f12
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision 79f417a64ad7845136da14dc776b14503797347e)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision 3b29807e8903b2cea3ee7a00a59b2b50f9de1f12)
@@ -75,7 +75,7 @@
-
+
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsFailureMechanismTreeNodeInfoTest.cs
===================================================================
diff -u -r3ba42e2c8b6380227f4b2e1d1897135ec962beab -r3b29807e8903b2cea3ee7a00a59b2b50f9de1f12
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsFailureMechanismTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsFailureMechanismTreeNodeInfoTest.cs) (revision 3ba42e2c8b6380227f4b2e1d1897135ec962beab)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsFailureMechanismTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsFailureMechanismTreeNodeInfoTest.cs) (revision 3b29807e8903b2cea3ee7a00a59b2b50f9de1f12)
@@ -38,6 +38,7 @@
using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
using Ringtoets.GrassCoverErosionInwards.Plugin;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+using GrassCoverErosionInwardsFormsResources = Ringtoets.GrassCoverErosionInwards.Forms.Properties.Resources;
namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.TreeNodeInfos
{
@@ -189,6 +190,50 @@
}
[Test]
+ public void ContextMenuStrip_Always_IsRelevantEnabledAddCalculationGroupAddCalculationItemItemDisabled()
+ {
+ // Setup
+ using (var treeView = new TreeViewControl())
+ {
+ var assessmentSection = mocksRepository.Stub();
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+ var failureMechanismContext = new GrassCoverErosionInwardsFailureMechanismContext(failureMechanism, assessmentSection);
+
+ var menuBuilderMock = new CustomItemsOnlyContextMenuBuilder();
+
+ var gui = mocksRepository.StrictMock();
+ gui.Expect(cmp => cmp.Get(failureMechanismContext, treeView)).Return(menuBuilderMock);
+ gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
+
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ var menu = info.ContextMenuStrip(failureMechanismContext, assessmentSection, treeView);
+
+ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuRelevancyIndex,
+ RingtoetsCommonFormsResources.FailureMechanismContextMenuStrip_Is_relevant,
+ RingtoetsCommonFormsResources.FailureMechanismContextMenuStrip_Is_relevant_Tooltip,
+ RingtoetsCommonFormsResources.Checkbox_ticked);
+ TestHelper.AssertContextMenuStripContainsItem(menu, 3,
+ RingtoetsCommonFormsResources.CalculationGroup_Add_CalculationGroup,
+ RingtoetsCommonFormsResources.FailureMechanism_Add_CalculationGroup_Tooltip,
+ RingtoetsCommonFormsResources.AddFolderIcon,
+ false);
+ TestHelper.AssertContextMenuStripContainsItem(menu, 4,
+ RingtoetsCommonFormsResources.CalculationGroup_Add_Calculation,
+ GrassCoverErosionInwardsFormsResources.GrassCoverErosionInwardsFailureMechanism_Add_GrassCoverErosionInwardsCalculation_Tooltip,
+ GrassCoverErosionInwardsFormsResources.CalculationIcon,
+ false);
+
+ // Assert
+ mocksRepository.VerifyAll();
+ }
+ }
+
+ [Test]
public void ContextMenuStrip_ClickOnIsRelevantItem_MakeFailureMechanismNotRelevant()
{
// Setup
Fisheye: Tag 3b29807e8903b2cea3ee7a00a59b2b50f9de1f12 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsInputContextTreeNodeInfo.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsInputContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsInputContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsInputContextTreeNodeInfoTest.cs (revision 3b29807e8903b2cea3ee7a00a59b2b50f9de1f12)
@@ -0,0 +1,143 @@
+// 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.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.Common.Data.AssessmentSection;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
+using Ringtoets.GrassCoverErosionInwards.Plugin;
+using GrassCoverErosionInwardsFormsResources = Ringtoets.GrassCoverErosionInwards.Forms.Properties.Resources;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsInputContextTreeNodeInfoTest
+ {
+ private MockRepository mocksRepository;
+ private GrassCoverErosionInwardsGuiPlugin plugin;
+ private TreeNodeInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocksRepository = new MockRepository();
+ plugin = new GrassCoverErosionInwardsGuiPlugin();
+ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(GrassCoverErosionInwardsInputContext));
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(GrassCoverErosionInwardsInputContext), info.TagType);
+ Assert.IsNull(info.ForeColor);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ 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.IsChecked);
+ 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 generalInput = new GeneralGrassCoverErosionInwardsInput();
+ var assessmentSection = mocksRepository.StrictMock();
+ var grassCoverErosionInwardsInputContext = new GrassCoverErosionInwardsInputContext(
+ mocksRepository.StrictMock(generalInput),
+ mocksRepository.StrictMock(generalInput),
+ mocksRepository.StrictMock(),
+ assessmentSection);
+ mocksRepository.ReplayAll();
+
+ // Call
+ var text = info.Text(grassCoverErosionInwardsInputContext);
+
+ // Assert
+ Assert.AreEqual(GrassCoverErosionInwardsFormsResources.GrassCoverErosionInwardsInputContext_NodeDisplayName, text);
+ mocksRepository.VerifyAll();
+ }
+
+ [Test]
+ public void Image_Always_ReturnsSetImage()
+ {
+ // Setup
+ var generalInput = new GeneralGrassCoverErosionInwardsInput();
+ var assessmentSection = mocksRepository.StrictMock();
+ var grassCoverErosionInwardsInputContext = new GrassCoverErosionInwardsInputContext(
+ mocksRepository.StrictMock(generalInput),
+ mocksRepository.StrictMock(generalInput),
+ mocksRepository.StrictMock(),
+ assessmentSection);
+ mocksRepository.ReplayAll();
+
+ // Call
+ var image = info.Image(grassCoverErosionInwardsInputContext);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image);
+
+ mocksRepository.VerifyAll();
+ }
+
+ [Test]
+ public void ContextMenuStrip_Always_CallsBuilder()
+ {
+ // Setup
+ var gui = mocksRepository.StrictMultiMock();
+ var treeViewControl = mocksRepository.StrictMock();
+ var menuBuilderMock = mocksRepository.StrictMock();
+
+ gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock);
+
+ menuBuilderMock.Expect(mb => mb.AddImportItem()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddExportItem()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.Build()).Return(null);
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(null, null, treeViewControl);
+
+ // Assert
+ mocksRepository.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismPlaceholderTreeNodeInfoTest.cs
===================================================================
diff -u -r3ba42e2c8b6380227f4b2e1d1897135ec962beab -r3b29807e8903b2cea3ee7a00a59b2b50f9de1f12
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismPlaceholderTreeNodeInfoTest.cs (.../FailureMechanismPlaceholderTreeNodeInfoTest.cs) (revision 3ba42e2c8b6380227f4b2e1d1897135ec962beab)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismPlaceholderTreeNodeInfoTest.cs (.../FailureMechanismPlaceholderTreeNodeInfoTest.cs) (revision 3b29807e8903b2cea3ee7a00a59b2b50f9de1f12)
@@ -243,7 +243,7 @@
}
[Test]
- public void ContextMenuStrip_Always_CalculateAllAndClearAllItemDisabled()
+ public void ContextMenuStrip_Always_IsRelevantEnabledCalculateAllAndClearAllItemDisabled()
{
// Setup
using (var treeView = new TreeViewControl())
@@ -270,6 +270,10 @@
// Call
var menu = info.ContextMenuStrip(context, assessmentSection, treeView);
+ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuRelevancyIndex,
+ RingtoetsCommonFormsResources.FailureMechanismContextMenuStrip_Is_relevant,
+ RingtoetsCommonFormsResources.FailureMechanismContextMenuStrip_Is_relevant_Tooltip,
+ RingtoetsCommonFormsResources.Checkbox_ticked);
TestHelper.AssertContextMenuStripContainsItem(menu, 2,
RingtoetsCommonFormsResources.Calculate_all,
RingtoetsCommonFormsResources.Calculate_all_ToolTip,
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs
===================================================================
diff -u -r3ba42e2c8b6380227f4b2e1d1897135ec962beab -r3b29807e8903b2cea3ee7a00a59b2b50f9de1f12
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs (.../PipingFailureMechanismTreeNodeInfoTest.cs) (revision 3ba42e2c8b6380227f4b2e1d1897135ec962beab)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs (.../PipingFailureMechanismTreeNodeInfoTest.cs) (revision 3b29807e8903b2cea3ee7a00a59b2b50f9de1f12)
@@ -57,6 +57,13 @@
private PipingGuiPlugin plugin;
private TreeNodeInfo info;
+ private const int contextMenuRelevancyIndex = 1;
+ private const int contextMenuAddFolderIndex = 3;
+ private const int contextMenuAddCalculationIndex = 4;
+ private const int contextMenuValidateAllIndex = 6;
+ private const int contextMenuCalculateAllIndex = 7;
+ private const int contextMenuClearIndex = 8;
+
[SetUp]
public void SetUp()
{
@@ -682,12 +689,5 @@
Assert.IsFalse(failureMechanism.IsRelevant);
mocks.VerifyAll();
}
-
- private const int contextMenuRelevancyIndex = 1;
- private const int contextMenuAddFolderIndex = 3;
- private const int contextMenuAddCalculationIndex = 4;
- private const int contextMenuValidateAllIndex = 6;
- private const int contextMenuCalculateAllIndex = 7;
- private const int contextMenuClearIndex = 8;
}
}
\ No newline at end of file