Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightContext.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightContext.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightContext.cs (revision b32ec68f52968bc821b67cd973544bc2d0e7d568) @@ -0,0 +1,40 @@ +// 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; +using Core.Common.Controls.PresentationObjects; +using Ringtoets.Common.Data.AssessmentSection; + +namespace Ringtoets.Integration.Forms.PresentationObjects +{ + /// + /// Presentation object for all data required to configure an instance of . + /// + public class WaveHeightContext : ObservableWrappedObjectContextBase + { + /// + /// Creates a new instance of . + /// + /// The which the belongs to. + /// Thrown when is null. + public WaveHeightContext(IAssessmentSection wrappedAssessmentSection) : base(wrappedAssessmentSection) { } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -rf5af57abda671e4a646797b0e78e03ba1835c6d5 -rb32ec68f52968bc821b67cd973544bc2d0e7d568 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f5af57abda671e4a646797b0e78e03ba1835c6d5) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b32ec68f52968bc821b67cd973544bc2d0e7d568) @@ -627,5 +627,41 @@ return ResourceManager.GetString("SelectHydraulicBoundaryDatabaseFile_Title", resourceCulture); } } + + /// + /// Looks up a localized string similar to &Berekenen. + /// + public static string WaveHeight_Calculate { + get { + return ResourceManager.GetString("WaveHeight_Calculate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Bereken de golfhoogtes. + /// + public static string WaveHeight_Calculate_ToolTip { + get { + return ResourceManager.GetString("WaveHeight_Calculate_ToolTip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Er is geen hydraulische randvoorwaardendatabase beschikbaar om de golfhoogtes te berekenen.. + /// + public static string WaveHeight_No_HRD_To_Calculate { + get { + return ResourceManager.GetString("WaveHeight_No_HRD_To_Calculate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Golfhoogtes. + /// + public static string WaveHeightContext_DisplayName { + get { + return ResourceManager.GetString("WaveHeightContext_DisplayName", resourceCulture); + } + } } } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx =================================================================== diff -u -rf5af57abda671e4a646797b0e78e03ba1835c6d5 -rb32ec68f52968bc821b67cd973544bc2d0e7d568 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision f5af57abda671e4a646797b0e78e03ba1835c6d5) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision b32ec68f52968bc821b67cd973544bc2d0e7d568) @@ -305,4 +305,16 @@ Toetspeil + + Golfhoogtes + + + Er is geen hydraulische randvoorwaardendatabase beschikbaar om de golfhoogtes te berekenen. + + + &Berekenen + + + Bereken de golfhoogtes + \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -rc703acd9b4aa18825e6938815ba975c34949cc6f -rb32ec68f52968bc821b67cd973544bc2d0e7d568 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision c703acd9b4aa18825e6938815ba975c34949cc6f) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision b32ec68f52968bc821b67cd973544bc2d0e7d568) @@ -54,6 +54,7 @@ + Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -rc703acd9b4aa18825e6938815ba975c34949cc6f -rb32ec68f52968bc821b67cd973544bc2d0e7d568 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision c703acd9b4aa18825e6938815ba975c34949cc6f) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision b32ec68f52968bc821b67cd973544bc2d0e7d568) @@ -448,6 +448,17 @@ Color.FromKnownColor(KnownColor.ControlText), ContextMenuStrip = DesignWaterLevelContextMenuStrip }; + + yield return new TreeNodeInfo + { + Text = designWaterLevel => RingtoetsFormsResources.WaveHeightContext_DisplayName, + Image = designWaterLevel => RingtoetsCommonFormsResources.GenericInputOutputIcon, + CanRename = (context, o) => false, + ForeColor = context => context.WrappedData.HydraulicBoundaryDatabase == null ? + Color.FromKnownColor(KnownColor.GrayText) : + Color.FromKnownColor(KnownColor.ControlText), + ContextMenuStrip = WaveHeightContextMenuStrip + }; yield return CreateFailureMechanismSectionResultTreeNodeInfo(); yield return CreateFailureMechanismSectionResultTreeNodeInfo(); @@ -966,7 +977,8 @@ { return new object[] { - new DesignWaterLevelContext(nodeData.WrappedData) + new DesignWaterLevelContext(nodeData.WrappedData), + new WaveHeightContext(nodeData.WrappedData) }; } @@ -1007,6 +1019,27 @@ .Build(); } + private ContextMenuStrip WaveHeightContextMenuStrip(WaveHeightContext nodeData, object parentData, TreeViewControl treeViewControl) + { + var waveHeightItem = new StrictContextMenuItem( + RingtoetsFormsResources.WaveHeight_Calculate, + RingtoetsFormsResources.WaveHeight_Calculate_ToolTip, + RingtoetsCommonFormsResources.FailureMechanismIcon, + null); + + if (nodeData.WrappedData.HydraulicBoundaryDatabase == null) + { + waveHeightItem.Enabled = false; + waveHeightItem.ToolTipText = RingtoetsFormsResources.WaveHeight_No_HRD_To_Calculate; + } + + return Gui.Get(nodeData, treeViewControl) + .AddCustomItem(waveHeightItem) + .AddSeparator() + .AddPropertiesItem() + .Build(); + } + private ContextMenuStrip HydraulicBoundaryDatabaseContextMenuStrip(HydraulicBoundaryDatabaseContext nodeData, object parentData, TreeViewControl treeViewControl) { var connectionItem = new StrictContextMenuItem( Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelContextTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelContextTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelContextTest.cs (revision b32ec68f52968bc821b67cd973544bc2d0e7d568) @@ -0,0 +1,50 @@ +// 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 Core.Common.Controls.PresentationObjects; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Integration.Forms.PresentationObjects; + +namespace Ringtoets.Integration.Forms.Test.PresentationObjects +{ + [TestFixture] + public class DesignWaterLevelContextTest + { + [Test] + public void DefaultConstructor_ExpectedValues() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSectionMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + // Call + var presentationObject = new DesignWaterLevelContext(assessmentSectionMock); + + // Assert + Assert.IsInstanceOf>(presentationObject); + Assert.AreSame(assessmentSectionMock, presentationObject.WrappedData); + mockRepository.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs =================================================================== diff -u -re775448bfb8290e43d62340a53a08723bbc035c6 -rb32ec68f52968bc821b67cd973544bc2d0e7d568 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs (.../HydraulicBoundaryDatabaseContextTest.cs) (revision e775448bfb8290e43d62340a53a08723bbc035c6) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs (.../HydraulicBoundaryDatabaseContextTest.cs) (revision b32ec68f52968bc821b67cd973544bc2d0e7d568) @@ -34,17 +34,17 @@ public void DefaultConstructor_ExpectedValues() { // Setup - var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); - mocks.ReplayAll(); + var mockRepository = new MockRepository(); + var assessmentSectionMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); // Call - var pressentationObject = new HydraulicBoundaryDatabaseContext(assessmentSectionMock); + var presentationObject = new HydraulicBoundaryDatabaseContext(assessmentSectionMock); // Assert - Assert.IsInstanceOf>(pressentationObject); - Assert.AreSame(assessmentSectionMock, pressentationObject.WrappedData); - mocks.VerifyAll(); + Assert.IsInstanceOf>(presentationObject); + Assert.AreSame(assessmentSectionMock, presentationObject.WrappedData); + mockRepository.VerifyAll(); } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightContextTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightContextTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightContextTest.cs (revision b32ec68f52968bc821b67cd973544bc2d0e7d568) @@ -0,0 +1,50 @@ +// 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 Core.Common.Controls.PresentationObjects; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Integration.Forms.PresentationObjects; + +namespace Ringtoets.Integration.Forms.Test.PresentationObjects +{ + [TestFixture] + public class WaveHeightContextTest + { + [Test] + public void DefaultConstructor_ExpectedValues() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSectionMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + // Call + var presentationObject = new WaveHeightContext(assessmentSectionMock); + + // Assert + Assert.IsInstanceOf>(presentationObject); + Assert.AreSame(assessmentSectionMock, presentationObject.WrappedData); + mockRepository.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -rc703acd9b4aa18825e6938815ba975c34949cc6f -rb32ec68f52968bc821b67cd973544bc2d0e7d568 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision c703acd9b4aa18825e6938815ba975c34949cc6f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision b32ec68f52968bc821b67cd973544bc2d0e7d568) @@ -64,7 +64,9 @@ + + @@ -90,6 +92,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelContextTreeNodeInfoTest.cs =================================================================== diff -u -rd33d74d616497db618951c564fdc6aca1fd1f1a8 -rb32ec68f52968bc821b67cd973544bc2d0e7d568 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelContextTreeNodeInfoTest.cs (.../DesignWaterLevelContextTreeNodeInfoTest.cs) (revision d33d74d616497db618951c564fdc6aca1fd1f1a8) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelContextTreeNodeInfoTest.cs (.../DesignWaterLevelContextTreeNodeInfoTest.cs) (revision b32ec68f52968bc821b67cd973544bc2d0e7d568) @@ -76,9 +76,6 @@ [Test] public void Text_Always_ReturnsSetName() { - // Setup - mocks.ReplayAll(); - using (var plugin = new RingtoetsPlugin()) { var info = GetInfo(plugin); @@ -89,15 +86,11 @@ // Assert Assert.AreEqual("Toetspeil", text); } - mocks.VerifyAll(); } [Test] public void Image_Always_ReturnsGenericIcon() { - // Setup - mocks.ReplayAll(); - using (var plugin = new RingtoetsPlugin()) { var info = GetInfo(plugin); @@ -108,15 +101,11 @@ // Assert TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image); } - mocks.VerifyAll(); } [Test] public void CanRenameNode_Always_ReturnsFalse() { - // Setup - mocks.ReplayAll(); - using (var plugin = new RingtoetsPlugin()) { var info = GetInfo(plugin); @@ -127,7 +116,6 @@ // Assert Assert.IsFalse(renameAllowed); } - mocks.VerifyAll(); } [Test] @@ -200,7 +188,7 @@ TestHelper.AssertContextMenuStripContainsItem(contextMenu, 0, expectedItemText, expectedItemTooltip, RingtoetsCommonFormsResources.FailureMechanismIcon, false); } } - + mocks.VerifyAll(); // Expect no calls on arguments } @@ -237,7 +225,7 @@ TestHelper.AssertContextMenuStripContainsItem(contextMenu, 0, expectedItemText, expectedItemTooltip, RingtoetsCommonFormsResources.FailureMechanismIcon); } } - + mocks.VerifyAll(); // Expect no calls on arguments } @@ -301,7 +289,7 @@ } [Test] - public void ForeColor_ContextHasNoReferenceLine_ReturnDisabledColor() + public void ForeColor_ContextHasNoHydraulicBoundaryDatabase_ReturnDisabledColor() { // Setup var assessmentSection = mocks.Stub(); @@ -323,7 +311,7 @@ } [Test] - public void ForeColor_ContextHasReferenceLineData_ReturnControlText() + public void ForeColor_ContextHasHydraulicBoundaryDatabaseData_ReturnControlText() { // Setup var assessmentSection = mocks.Stub(); @@ -344,7 +332,7 @@ } mocks.VerifyAll(); } - + private TreeNodeInfo GetInfo(RingtoetsPlugin plugin) { return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(DesignWaterLevelContext)); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightContextTreeNodeInfoTest.cs (revision b32ec68f52968bc821b67cd973544bc2d0e7d568) @@ -0,0 +1,241 @@ +// 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.Drawing; +using System.Linq; +using Core.Common.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.ContextMenu; +using Core.Common.Gui.TestUtil.ContextMenu; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Forms.Properties; +using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; +using Ringtoets.Integration.Plugin; + +namespace Ringtoets.Integration.Forms.Test.TreeNodeInfos +{ + public class WaveHeightContextTreeNodeInfoTest + { + private MockRepository mockRepository; + + [SetUp] + public void SetUp() + { + mockRepository = new MockRepository(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + mockRepository.ReplayAll(); + + using (var plugin = new RingtoetsPlugin()) + { + var info = GetInfo(plugin); + + // Assert + Assert.AreEqual(typeof(WaveHeightContext), info.TagType); + 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); + } + mockRepository.VerifyAll(); + } + + [Test] + public void Text_Always_ReturnsSetName() + { + using (var plugin = new RingtoetsPlugin()) + { + var info = GetInfo(plugin); + + // Call + var text = info.Text(null); + + // Assert + const string expectedName = "Golfhoogtes"; + Assert.AreEqual(expectedName, text); + } + } + + [Test] + public void Image_Always_ReturnsGenericIcon() + { + using (var plugin = new RingtoetsPlugin()) + { + var info = GetInfo(plugin); + + // Call + var image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(Resources.GenericInputOutputIcon, image); + } + } + + [Test] + public void CanRenameNode_Always_ReturnsFalse() + { + using (var plugin = new RingtoetsPlugin()) + { + var info = GetInfo(plugin); + + // Call + var renameAllowed = info.CanRename(null, null); + + // Assert + Assert.IsFalse(renameAllowed); + } + } + + [Test] + public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() + { + // Setup + var guiMock = mockRepository.StrictMock(); + var menuBuilderMock = mockRepository.StrictMock(); + var assessmentSectionMock = mockRepository.Stub(); + + var nodeData = new WaveHeightContext(assessmentSectionMock); + + menuBuilderMock.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + guiMock.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + guiMock.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + + using (var treeViewControl = new TreeViewControl()) + { + guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilderMock); + + mockRepository.ReplayAll(); + + using (var plugin = new RingtoetsPlugin()) + { + var info = GetInfo(plugin); + + plugin.Gui = guiMock; + + // Call + info.ContextMenuStrip(nodeData, null, treeViewControl); + } + } + // Assert + mockRepository.VerifyAll(); + } + + [Test] + public void ContextMenuStrip_NoHydraulicBoundaryDatabaseSet_ContextMenuItemCalculateDisabled() + { + // Setup + var guiMock = mockRepository.StrictMock(); + var assessmentSectionMock = mockRepository.Stub(); + + var nodeData = new WaveHeightContext(assessmentSectionMock); + + guiMock.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + guiMock.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + + using (var treeViewControl = new TreeViewControl()) + { + guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + mockRepository.ReplayAll(); + + using (var plugin = new RingtoetsPlugin()) + { + var info = GetInfo(plugin); + + plugin.Gui = guiMock; + + // Call + var contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl); + + // Assert + const string expectedItemText = "&Berekenen"; + const string expectedItemTooltip = "Er is geen hydraulische randvoorwaardendatabase beschikbaar om de golfhoogtes te berekenen."; + TestHelper.AssertContextMenuStripContainsItem(contextMenu, 0, expectedItemText, expectedItemTooltip, Resources.FailureMechanismIcon, false); + } + } + + mockRepository.VerifyAll(); // Expect no calls on arguments + } + + [Test] + public void ForeColor_ContextHasNoHydraulicBoundaryDatabase_ReturnDisabledColor() + { + // Setup + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + + var designWaterLevelContext = new WaveHeightContext(assessmentSection); + + using (var plugin = new RingtoetsPlugin()) + { + var info = GetInfo(plugin); + + // Call + Color color = info.ForeColor(designWaterLevelContext); + + // Assert + Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); + } + mockRepository.VerifyAll(); + } + + [Test] + public void ForeColor_ContextHasHydraulicBoundaryDatabaseData_ReturnControlText() + { + // Setup + var assessmentSection = mockRepository.Stub(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + mockRepository.ReplayAll(); + + var designWaterLevelContext = new WaveHeightContext(assessmentSection); + + using (var plugin = new RingtoetsPlugin()) + { + var info = GetInfo(plugin); + + // Call + Color color = info.ForeColor(designWaterLevelContext); + + // Assert + Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color); + } + mockRepository.VerifyAll(); + } + + private static TreeNodeInfo GetInfo(RingtoetsPlugin plugin) + { + return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(WaveHeightContext)); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs =================================================================== diff -u -rc703acd9b4aa18825e6938815ba975c34949cc6f -rb32ec68f52968bc821b67cd973544bc2d0e7d568 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision c703acd9b4aa18825e6938815ba975c34949cc6f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision b32ec68f52968bc821b67cd973544bc2d0e7d568) @@ -366,7 +366,7 @@ TreeNodeInfo[] treeNodeInfos = plugin.GetTreeNodeInfos().ToArray(); // Assert - Assert.AreEqual(26, treeNodeInfos.Length); + Assert.AreEqual(27, treeNodeInfos.Length); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(IAssessmentSection))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ReferenceLineContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismContext))); @@ -375,6 +375,7 @@ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismContributionContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(HydraulicBoundaryDatabaseContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(DesignWaterLevelContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaveHeightContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)));