Fisheye: Tag 7e73b46787b05288e766f041ba935e20edf1eb93 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsCalculationInputContext.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj =================================================================== diff -u -rf2f090c06a26700c54c1e85dbc49c20cceeadeec -r7e73b46787b05288e766f041ba935e20edf1eb93 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.csproj) (revision f2f090c06a26700c54c1e85dbc49c20cceeadeec) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.csproj) (revision 7e73b46787b05288e766f041ba935e20edf1eb93) @@ -50,7 +50,6 @@ - Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs =================================================================== diff -u -r7719a619d76f39384209dba87f836da02cf2846a -r7e73b46787b05288e766f041ba935e20edf1eb93 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 7719a619d76f39384209dba87f836da02cf2846a) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 7e73b46787b05288e766f041ba935e20edf1eb93) @@ -51,6 +51,7 @@ using Ringtoets.GrassCoverErosionOutwards.Service.MessageProviders; using Ringtoets.HydraRing.Data; using Ringtoets.HydraRing.IO; +using Ringtoets.Revetment.Forms.PresentationObjects; using Ringtoets.Revetment.Service; using RingtoetsGrassCoverErosionOutwardsFormsResources = Ringtoets.GrassCoverErosionOutwards.Forms.Properties.Resources; using RingtoetsGrassCoverErosionOutwardsDataResources = Ringtoets.GrassCoverErosionOutwards.Data.Properties.Resources; @@ -160,7 +161,7 @@ ContextMenuStrip = GrassCoverErosionOutwardsWaveHeightLocationsContextMenuStrip }; - yield return new TreeNodeInfo + yield return new TreeNodeInfo { Text = context => RingtoetsCommonFormsResources.Calculation_Input, Image = context => RingtoetsCommonFormsResources.GenericInputOutputIcon, @@ -652,9 +653,9 @@ var childNodes = new List { new CommentContext(context.WrappedData), - new GrassCoverErosionOutwardsWaveConditionsCalculationInputContext(context.WrappedData.InputParameters, - context.FailureMechanism, - context.AssessmentSection) + new WaveConditionsInputContext(context.WrappedData.InputParameters, + context.FailureMechanism.ForeshoreProfiles, + context.AssessmentSection) }; if (context.WrappedData.HasOutput) Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/Ringtoets.GrassCoverErosionOutwards.Plugin.csproj =================================================================== diff -u -redf9df0fe998b3472d211d0fb3fa3da1209be613 -r7e73b46787b05288e766f041ba935e20edf1eb93 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/Ringtoets.GrassCoverErosionOutwards.Plugin.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.csproj) (revision edf9df0fe998b3472d211d0fb3fa3da1209be613) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/Ringtoets.GrassCoverErosionOutwards.Plugin.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.csproj) (revision 7e73b46787b05288e766f041ba935e20edf1eb93) @@ -125,6 +125,11 @@ Ringtoets.Revetment.Data False + + {AF1ACFA2-AEE5-4DB7-98CA-8B3720E46AD9} + Ringtoets.Revetment.Forms + False + {2331235F-1E56-4344-ACC2-191C22A39594} Ringtoets.Revetment.Service Fisheye: Tag 7e73b46787b05288e766f041ba935e20edf1eb93 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PropertyClasses/GrassCoverErosionOutwardsWaveConditionsCalculationInputContextTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj =================================================================== diff -u -rf2f090c06a26700c54c1e85dbc49c20cceeadeec -r7e73b46787b05288e766f041ba935e20edf1eb93 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj) (revision f2f090c06a26700c54c1e85dbc49c20cceeadeec) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj) (revision 7e73b46787b05288e766f041ba935e20edf1eb93) @@ -78,7 +78,6 @@ - @@ -92,7 +91,7 @@ - + @@ -172,6 +171,10 @@ {87C2C553-C0BC-40BF-B1EA-B83BFF357F27} Ringtoets.Revetment.Data + + {AF1ACFA2-AEE5-4DB7-98CA-8B3720E46AD9} + Ringtoets.Revetment.Forms + {EA416DD2-1633-439E-8512-B9933E37B9C5} Ringtoets.Revetment.Service.TestUtil Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rf2f090c06a26700c54c1e85dbc49c20cceeadeec -r7e73b46787b05288e766f041ba935e20edf1eb93 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision f2f090c06a26700c54c1e85dbc49c20cceeadeec) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 7e73b46787b05288e766f041ba935e20edf1eb93) @@ -48,6 +48,7 @@ using Ringtoets.HydraRing.Calculation.TestUtil; using Ringtoets.HydraRing.Data; using Ringtoets.Revetment.Data; +using Ringtoets.Revetment.Forms.PresentationObjects; using Ringtoets.Revetment.Service.TestUtil; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; @@ -298,14 +299,35 @@ public void ChildNodeObjects_CalculationWithoutOutput_ReturnChildrenWithEmptyOutput() { // Setup + var location = new HydraulicBoundaryLocation(0, string.Empty, 0, 0); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + Locations = + { + location + } + }; + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; mocks.ReplayAll(); var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation { Output = null }; - var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + var foreshoreProfile = new ForeshoreProfile(new Point2D(0, 0), + Enumerable.Empty(), + new BreakWater(BreakWaterType.Caisson, 1), + new ForeshoreProfile.ConstructionProperties()); + + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism + { + ForeshoreProfiles = + { + foreshoreProfile + } + }; var context = new GrassCoverErosionOutwardsWaveConditionsCalculationContext(calculation, failureMechanism, assessmentSection); @@ -319,10 +341,10 @@ var commentsContext = (CommentContext)children[0]; Assert.AreSame(calculation, commentsContext.WrappedData); - var inputContext = (GrassCoverErosionOutwardsWaveConditionsCalculationInputContext)children[1]; + var inputContext = (WaveConditionsInputContext)children[1]; Assert.AreSame(calculation.InputParameters, inputContext.WrappedData); - Assert.AreSame(failureMechanism, inputContext.FailureMechanism); - Assert.AreSame(assessmentSection, inputContext.AssessmentSection); + CollectionAssert.AreEqual(new[] { foreshoreProfile }, inputContext.ForeshoreProfiles); + CollectionAssert.AreEqual(new[] { location }, inputContext.HydraulicBoundaryLocations); Assert.IsInstanceOf(children[2]); } @@ -331,14 +353,35 @@ public void ChildNodeObjects_CalculationWithOutput_ReturnChildrenWithOutput() { // Setup + var location = new HydraulicBoundaryLocation(0, string.Empty, 0, 0); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + Locations = + { + location + } + }; + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; mocks.ReplayAll(); var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation { Output = new GrassCoverErosionOutwardsWaveConditionsOutput(Enumerable.Empty()) }; - var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + var foreshoreProfile = new ForeshoreProfile(new Point2D(0, 0), + Enumerable.Empty(), + new BreakWater(BreakWaterType.Caisson, 1), + new ForeshoreProfile.ConstructionProperties()); + + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism + { + ForeshoreProfiles = + { + foreshoreProfile + } + }; var context = new GrassCoverErosionOutwardsWaveConditionsCalculationContext(calculation, failureMechanism, assessmentSection); @@ -352,10 +395,10 @@ var commentsContext = (CommentContext)children[0]; Assert.AreSame(calculation, commentsContext.WrappedData); - var inputContext = (GrassCoverErosionOutwardsWaveConditionsCalculationInputContext)children[1]; + var inputContext = (WaveConditionsInputContext)children[1]; Assert.AreSame(calculation.InputParameters, inputContext.WrappedData); - Assert.AreSame(failureMechanism, inputContext.FailureMechanism); - Assert.AreSame(assessmentSection, inputContext.AssessmentSection); + CollectionAssert.AreEqual(new[] { foreshoreProfile }, inputContext.ForeshoreProfiles); + CollectionAssert.AreEqual(new[] { location }, inputContext.HydraulicBoundaryLocations); var output = (GrassCoverErosionOutwardsWaveConditionsOutput)children[2]; Assert.AreSame(calculation.Output, output); Fisheye: Tag 7e73b46787b05288e766f041ba935e20edf1eb93 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationInputContextTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/WaveConditionsInputContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/WaveConditionsInputContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/TreeNodeInfos/WaveConditionsInputContextTreeNodeInfoTest.cs (revision 7e73b46787b05288e766f041ba935e20edf1eb93) @@ -0,0 +1,163 @@ +// 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.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.GrassCoverErosionOutwards.Plugin; +using Ringtoets.Revetment.Data; +using Ringtoets.Revetment.Forms.PresentationObjects; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.GrassCoverErosionOutwards.Forms.Test.TreeNodeInfos +{ + [TestFixture] + public class WaveConditionsInputContextTreeNodeInfoTest + { + private MockRepository mocks; + + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + var info = GetInfo(plugin); + + // Assert + Assert.IsNull(info.EnsureVisibleOnCreate); + 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); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.ForeColor); + } + } + + [Test] + public void Text_Always_ReturnName() + { + // Setup + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var input = new WaveConditionsInput(); + var context = new WaveConditionsInputContext(input, + new ForeshoreProfile[0], + assessmentSection); + + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + var info = GetInfo(plugin); + + // Call + string nodeText = info.Text(context); + + // Assert + Assert.AreEqual("Invoer", nodeText); + } + } + + [Test] + public void Image_Always_ReturnOutputIcon() + { + // Setup + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var input = new WaveConditionsInput(); + var context = new WaveConditionsInputContext(input, + new ForeshoreProfile[0], + assessmentSection); + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + var info = GetInfo(plugin); + // Call + Image icon = info.Image(context); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, icon); + } + } + + [Test] + public void ContextMenuStrip_FailureMechanismIsRelevant_CallsContextMenuBuilderMethods() + { + // Setup + using (var treeViewControl = new TreeViewControl()) + { + var assessmentSection = mocks.Stub(); + + var input = new WaveConditionsInput(); + var context = new WaveConditionsInputContext(input, + new ForeshoreProfile[0], + assessmentSection); + + var menuBuilder = mocks.StrictMock(); + menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.Build()).Return(null); + + var gui = mocks.StrictMock(); + gui.Expect(cmp => cmp.Get(context, treeViewControl)).Return(menuBuilder); + + mocks.ReplayAll(); + + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + var info = GetInfo(plugin); + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(context, null, treeViewControl); + } + } + + // Assert + // Assert expectancies are called in TearDown() + } + + private TreeNodeInfo GetInfo(GrassCoverErosionOutwardsPlugin plugin) + { + return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(WaveConditionsInputContext)); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs =================================================================== diff -u -rf2f090c06a26700c54c1e85dbc49c20cceeadeec -r7e73b46787b05288e766f041ba935e20edf1eb93 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision f2f090c06a26700c54c1e85dbc49c20cceeadeec) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision 7e73b46787b05288e766f041ba935e20edf1eb93) @@ -32,6 +32,7 @@ using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; using Ringtoets.GrassCoverErosionOutwards.Forms.PropertyClasses; using Ringtoets.GrassCoverErosionOutwards.Forms.Views; +using Ringtoets.Revetment.Forms.PresentationObjects; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; namespace Ringtoets.GrassCoverErosionOutwards.Plugin.Test @@ -87,7 +88,7 @@ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionOutwardsWaveHeightLocationsContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionOutwardsWaveConditionsCalculationGroupContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionOutwardsWaveConditionsCalculationContext))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionOutwardsWaveConditionsCalculationInputContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaveConditionsInputContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(EmptyGrassCoverErosionOutwardsOutput))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GrassCoverErosionOutwardsWaveConditionsOutput))); } Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj =================================================================== diff -u -rc43715cf3e6dce0c427b10c4852d5ae54e6d668d -r7e73b46787b05288e766f041ba935e20edf1eb93 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj) (revision c43715cf3e6dce0c427b10c4852d5ae54e6d668d) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj) (revision 7e73b46787b05288e766f041ba935e20edf1eb93) @@ -98,6 +98,10 @@ {4D840673-3812-4338-A352-84854E32B8A0} Ringtoets.Common.Forms + + {AF1ACFA2-AEE5-4DB7-98CA-8B3720E46AD9} + Ringtoets.Revetment.Forms + {E7225477-577F-4A17-B7EC-6721158E1543} Ringtoets.GrassCoverErosionOutwards.Data