Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/HydraulicBoundaryLocationCalculationContextTest.cs =================================================================== diff -u -rc95bf61382d8082993849902356f7177845994d9 -rf8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/HydraulicBoundaryLocationCalculationContextTest.cs (.../HydraulicBoundaryLocationCalculationContextTest.cs) (revision c95bf61382d8082993849902356f7177845994d9) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/HydraulicBoundaryLocationCalculationContextTest.cs (.../HydraulicBoundaryLocationCalculationContextTest.cs) (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -37,16 +37,16 @@ var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()); // Call - var context = new TestHydraulicBoundaryLocationContext(hydraulicBoundaryLocationCalculation); + var context = new TestHydraulicBoundaryCalculationContext(hydraulicBoundaryLocationCalculation); // Assert Assert.IsInstanceOf>(context); Assert.AreSame(hydraulicBoundaryLocationCalculation, context.WrappedData); } - private class TestHydraulicBoundaryLocationContext : HydraulicBoundaryLocationCalculationContext + private class TestHydraulicBoundaryCalculationContext : HydraulicBoundaryLocationCalculationContext { - public TestHydraulicBoundaryLocationContext(HydraulicBoundaryLocationCalculation calculation) + public TestHydraulicBoundaryCalculationContext(HydraulicBoundaryLocationCalculation calculation) : base(calculation) {} } } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelCalculationsGroupContext.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelCalculationsGroupContext.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelCalculationsGroupContext.cs (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -0,0 +1,59 @@ +// Copyright (C) Stichting Deltares 2017. 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.Base; +using Core.Common.Controls.PresentationObjects; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Hydraulics; + +namespace Ringtoets.Integration.Forms.PresentationObjects +{ + /// + /// Presentation object for all data required to configure multiple enumerations of + /// with a design water level calculation result. + /// + public class DesignWaterLevelCalculationsGroupContext : ObservableWrappedObjectContextBase> + { + /// + /// Creates a new instance of . + /// + /// The locations that the belongs to. + /// The that the belongs to. + /// Thrown when any parameter is null. + public DesignWaterLevelCalculationsGroupContext(ObservableList wrappedData, + IAssessmentSection assessmentSection) + : base(wrappedData) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + AssessmentSection = assessmentSection; + } + + /// + /// Gets the assessment section that the context belongs to. + /// + public IAssessmentSection AssessmentSection { get; } + } +} \ No newline at end of file Fisheye: Tag f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelLocationsGroupContext.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightCalculationsGroupContext.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightCalculationsGroupContext.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightCalculationsGroupContext.cs (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -0,0 +1,59 @@ +// Copyright (C) Stichting Deltares 2017. 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.Base; +using Core.Common.Controls.PresentationObjects; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Hydraulics; + +namespace Ringtoets.Integration.Forms.PresentationObjects +{ + /// + /// Presentation object for all data required to configure multiple enumerations of + /// with a wave height calculation result. + /// + public class WaveHeightCalculationsGroupContext : ObservableWrappedObjectContextBase> + { + /// + /// Creates a new instance of . + /// + /// The locations that the belongs to. + /// The that the belongs to. + /// Thrown when any parameter is null. + public WaveHeightCalculationsGroupContext(ObservableList wrappedData, + IAssessmentSection assessmentSection) + : base(wrappedData) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + AssessmentSection = assessmentSection; + } + + /// + /// Gets the assessment section that the context belongs to. + /// + public IAssessmentSection AssessmentSection { get; } + } +} \ No newline at end of file Fisheye: Tag f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightLocationsGroupContext.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -r466a02f3ba52351117297fcc1ea2d4242ab92b39 -rf8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 466a02f3ba52351117297fcc1ea2d4242ab92b39) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -28,13 +28,13 @@ - + - + Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r466a02f3ba52351117297fcc1ea2d4242ab92b39 -rf8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 466a02f3ba52351117297fcc1ea2d4242ab92b39) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -758,12 +758,12 @@ ContextMenuStrip = HydraulicBoundaryDatabaseContextMenuStrip }; - yield return new TreeNodeInfo + yield return new TreeNodeInfo { Text = context => RingtoetsFormsResources.DesignWaterLevelCalculationsContext_DisplayName, Image = context => RingtoetsCommonFormsResources.GeneralFolderIcon, - ContextMenuStrip = DesignWaterLevelLocationsGroupContextMenuStrip, - ChildNodeObjects = DesignWaterLevelLocationsGroupContextChildNodeObjects + ContextMenuStrip = DesignWaterLevelCalculationsGroupContextMenuStrip, + ChildNodeObjects = DesignWaterLevelCalculationsGroupContextChildNodeObjects }; yield return new TreeNodeInfo @@ -773,12 +773,12 @@ ContextMenuStrip = DesignWaterLevelCalculationsContextMenuStrip }; - yield return new TreeNodeInfo + yield return new TreeNodeInfo { Text = context => RingtoetsFormsResources.WaveHeightCalculationsContext_DisplayName, Image = context => RingtoetsCommonFormsResources.GeneralFolderIcon, - ContextMenuStrip = WaveHeightLocationsGroupContextMenuStrip, - ChildNodeObjects = WaveHeightLocationsGroupContextChildNodeObjects + ContextMenuStrip = WaveHeightCalculationsGroupContextMenuStrip, + ChildNodeObjects = WaveHeightCalculationsGroupContextChildNodeObjects }; yield return new TreeNodeInfo @@ -1726,10 +1726,10 @@ { return new object[] { - new DesignWaterLevelLocationsGroupContext(nodeData.WrappedData.Locations, - nodeData.AssessmentSection), - new WaveHeightLocationsGroupContext(nodeData.WrappedData.Locations, - nodeData.AssessmentSection) + new DesignWaterLevelCalculationsGroupContext(nodeData.WrappedData.Locations, + nodeData.AssessmentSection), + new WaveHeightCalculationsGroupContext(nodeData.WrappedData.Locations, + nodeData.AssessmentSection) }; } @@ -1942,23 +1942,23 @@ log.Info(RingtoetsFormsResources.Calculations_Cleared); } - private ContextMenuStrip DesignWaterLevelLocationsGroupContextMenuStrip(DesignWaterLevelLocationsGroupContext nodeData, object parentData, TreeViewControl treeViewControl) + private ContextMenuStrip DesignWaterLevelCalculationsGroupContextMenuStrip(DesignWaterLevelCalculationsGroupContext nodeData, object parentData, TreeViewControl treeViewControl) { return Gui.Get(nodeData, treeViewControl) .AddCollapseAllItem() .AddExpandAllItem() .Build(); } - private ContextMenuStrip WaveHeightLocationsGroupContextMenuStrip(WaveHeightLocationsGroupContext nodeData, object parentData, TreeViewControl treeViewControl) + private ContextMenuStrip WaveHeightCalculationsGroupContextMenuStrip(WaveHeightCalculationsGroupContext nodeData, object parentData, TreeViewControl treeViewControl) { return Gui.Get(nodeData, treeViewControl) .AddCollapseAllItem() .AddExpandAllItem() .Build(); } - private static object[] DesignWaterLevelLocationsGroupContextChildNodeObjects(DesignWaterLevelLocationsGroupContext context) + private static object[] DesignWaterLevelCalculationsGroupContextChildNodeObjects(DesignWaterLevelCalculationsGroupContext context) { return new object[] { @@ -1981,7 +1981,7 @@ }; } - private static object[] WaveHeightLocationsGroupContextChildNodeObjects(WaveHeightLocationsGroupContext context) + private static object[] WaveHeightCalculationsGroupContextChildNodeObjects(WaveHeightCalculationsGroupContext context) { return new object[] { Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelCalculationsContextTest.cs =================================================================== diff -u -r59a82ae3063f2dda858cc5cf43e25c224856d88d -rf8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelCalculationsContextTest.cs (.../DesignWaterLevelCalculationsContextTest.cs) (revision 59a82ae3063f2dda858cc5cf43e25c224856d88d) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelCalculationsContextTest.cs (.../DesignWaterLevelCalculationsContextTest.cs) (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -48,17 +48,17 @@ const string categoryBoundaryName = "Test name"; // Call - var presentationObject = new DesignWaterLevelCalculationsContext(calculations, - assessmentSection, - getNormFunc, - categoryBoundaryName); + var context = new DesignWaterLevelCalculationsContext(calculations, + assessmentSection, + getNormFunc, + categoryBoundaryName); // Assert - Assert.IsInstanceOf>>(presentationObject); - Assert.AreSame(calculations, presentationObject.WrappedData); - Assert.AreSame(assessmentSection, presentationObject.AssessmentSection); - Assert.AreSame(getNormFunc, presentationObject.GetNormFunc); - Assert.AreEqual(categoryBoundaryName, presentationObject.CategoryBoundaryName); + Assert.IsInstanceOf>>(context); + Assert.AreSame(calculations, context.WrappedData); + Assert.AreSame(assessmentSection, context.AssessmentSection); + Assert.AreSame(getNormFunc, context.GetNormFunc); + Assert.AreEqual(categoryBoundaryName, context.CategoryBoundaryName); mockRepository.VerifyAll(); } Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelCalculationsGroupContextTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelCalculationsGroupContextTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelCalculationsGroupContextTest.cs (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -0,0 +1,67 @@ +// Copyright (C) Stichting Deltares 2017. 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.Base; +using Core.Common.Controls.PresentationObjects; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Integration.Forms.PresentationObjects; + +namespace Ringtoets.Integration.Forms.Test.PresentationObjects +{ + [TestFixture] + public class DesignWaterLevelCalculationsGroupContextTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + + var locations = new ObservableList(); + + // Call + var context = new DesignWaterLevelCalculationsGroupContext(locations, assessmentSection); + + // Assert + Assert.IsInstanceOf>>(context); + Assert.AreSame(locations, context.WrappedData); + Assert.AreSame(assessmentSection, context.AssessmentSection); + mockRepository.VerifyAll(); + } + + [Test] + public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new DesignWaterLevelCalculationsGroupContext(new ObservableList(), null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("assessmentSection", exception.ParamName); + } + } +} \ No newline at end of file Fisheye: Tag f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelLocationsGroupContextTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs =================================================================== diff -u -rc114776ae9eae9848dd5841211bbe2105ae57dc7 -rf8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs (.../HydraulicBoundaryDatabaseContextTest.cs) (revision c114776ae9eae9848dd5841211bbe2105ae57dc7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/HydraulicBoundaryDatabaseContextTest.cs (.../HydraulicBoundaryDatabaseContextTest.cs) (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -39,12 +39,12 @@ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); // Call - var presentationObject = new HydraulicBoundaryDatabaseContext(assessmentSection.HydraulicBoundaryDatabase, assessmentSection); + var context = new HydraulicBoundaryDatabaseContext(assessmentSection.HydraulicBoundaryDatabase, assessmentSection); // Assert - Assert.IsInstanceOf>(presentationObject); - Assert.AreSame(assessmentSection.HydraulicBoundaryDatabase, presentationObject.WrappedData); - Assert.AreSame(assessmentSection, presentationObject.AssessmentSection); + Assert.IsInstanceOf>(context); + Assert.AreSame(assessmentSection.HydraulicBoundaryDatabase, context.WrappedData); + Assert.AreSame(assessmentSection, context.AssessmentSection); } [Test] Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightCalculationsContextTest.cs =================================================================== diff -u -r466a02f3ba52351117297fcc1ea2d4242ab92b39 -rf8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightCalculationsContextTest.cs (.../WaveHeightCalculationsContextTest.cs) (revision 466a02f3ba52351117297fcc1ea2d4242ab92b39) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightCalculationsContextTest.cs (.../WaveHeightCalculationsContextTest.cs) (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -48,17 +48,17 @@ const string categoryBoundaryName = "Test name"; // Call - var presentationObject = new WaveHeightCalculationsContext(calculations, - assessmentSection, - getNormFunc, - categoryBoundaryName); + var context = new WaveHeightCalculationsContext(calculations, + assessmentSection, + getNormFunc, + categoryBoundaryName); // Assert - Assert.IsInstanceOf>>(presentationObject); - Assert.AreSame(calculations, presentationObject.WrappedData); - Assert.AreSame(assessmentSection, presentationObject.AssessmentSection); - Assert.AreSame(getNormFunc, presentationObject.GetNormFunc); - Assert.AreEqual(categoryBoundaryName, presentationObject.CategoryBoundaryName); + Assert.IsInstanceOf>>(context); + Assert.AreSame(calculations, context.WrappedData); + Assert.AreSame(assessmentSection, context.AssessmentSection); + Assert.AreSame(getNormFunc, context.GetNormFunc); + Assert.AreEqual(categoryBoundaryName, context.CategoryBoundaryName); mockRepository.VerifyAll(); } Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightCalculationsGroupContextTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightCalculationsGroupContextTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightCalculationsGroupContextTest.cs (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -0,0 +1,67 @@ +// Copyright (C) Stichting Deltares 2017. 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.Base; +using Core.Common.Controls.PresentationObjects; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Integration.Forms.PresentationObjects; + +namespace Ringtoets.Integration.Forms.Test.PresentationObjects +{ + [TestFixture] + public class WaveHeightCalculationsGroupContextTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + + var locations = new ObservableList(); + + // Call + var context = new WaveHeightCalculationsGroupContext(locations, assessmentSection); + + // Assert + Assert.IsInstanceOf>>(context); + Assert.AreSame(locations, context.WrappedData); + Assert.AreSame(assessmentSection, context.AssessmentSection); + mockRepository.VerifyAll(); + } + + [Test] + public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new WaveHeightCalculationsGroupContext(new ObservableList(), null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("assessmentSection", exception.ParamName); + } + } +} \ No newline at end of file Fisheye: Tag f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightLocationsGroupContextTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -r466a02f3ba52351117297fcc1ea2d4242ab92b39 -rf8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 466a02f3ba52351117297fcc1ea2d4242ab92b39) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -38,10 +38,10 @@ - + - + Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -r466a02f3ba52351117297fcc1ea2d4242ab92b39 -rf8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 466a02f3ba52351117297fcc1ea2d4242ab92b39) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -70,7 +70,7 @@ - + @@ -92,7 +92,7 @@ - + Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs =================================================================== diff -u -r466a02f3ba52351117297fcc1ea2d4242ab92b39 -rf8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 466a02f3ba52351117297fcc1ea2d4242ab92b39) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -488,9 +488,9 @@ 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(DesignWaterLevelCalculationsContext))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(DesignWaterLevelLocationsGroupContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(DesignWaterLevelCalculationsGroupContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaveHeightCalculationsContext))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaveHeightLocationsGroupContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaveHeightCalculationsGroupContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ForeshoreProfilesContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(DikeProfile))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ForeshoreProfile))); Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelCalculationsGroupContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelCalculationsGroupContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelCalculationsGroupContextTreeNodeInfoTest.cs (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -0,0 +1,209 @@ +// Copyright (C) Stichting Deltares 2017. 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.Base; +using Core.Common.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.ContextMenu; +using Core.Common.TestUtil; +using NUnit.Extensions.Forms; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Contribution; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Integration.Forms.PresentationObjects; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Plugin.Test.TreeNodeInfos +{ + [TestFixture] + public class DesignWaterLevelCalculationsGroupContextTreeNodeInfoTest : NUnitFormTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // 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.IsNotNull(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_ReturnsSetName() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + string text = info.Text(null); + + // Assert + Assert.AreEqual("Toetspeilen", text); + } + } + + [Test] + public void Image_Always_ReturnsGeneralFolderIcon() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + Image image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GeneralFolderIcon, image); + } + } + + [Test] + public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.StrictMock(); + var menuBuilder = mockRepository.StrictMock(); + + using (mockRepository.Ordered()) + { + menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.Build()).Return(null); + } + + var nodeData = new DesignWaterLevelCalculationsGroupContext(new ObservableList(), + assessmentSection); + + using (var treeViewControl = new TreeViewControl()) + { + var gui = mockRepository.Stub(); + gui.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); + mockRepository.ReplayAll(); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(nodeData, null, treeViewControl); + } + } + + // Assert + mockRepository.VerifyAll(); + } + + [Test] + public void ChildNodeObjects_Always_ReturnsChildrenOfData() + { + // Setup + const double signalingNorm = 0.002; + const double lowerLimitNorm = 0.005; + + var mocks = new MockRepository(); + var assessmentSection = mocks.StrictMock(); + assessmentSection.Expect(a => a.FailureMechanismContribution) + .Return(new FailureMechanismContribution( + Enumerable.Empty(), + 10, + lowerLimitNorm, + signalingNorm)) + .Repeat.Any(); + + mocks.ReplayAll(); + + var locations = new ObservableList(); + var calculationsGroupContext = new DesignWaterLevelCalculationsGroupContext(locations, assessmentSection); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + object[] childNodeObjects = info.ChildNodeObjects(calculationsGroupContext); + + // Assert + Assert.AreEqual(4, childNodeObjects.Length); + + DesignWaterLevelCalculationsContext[] calculationsContexts = childNodeObjects.OfType().ToArray(); + Assert.AreEqual(4, calculationsContexts.Length); + + Assert.IsTrue(calculationsContexts.All(c => ReferenceEquals(assessmentSection, c.AssessmentSection))); + + Assert.AreEqual("Categorie A+->A", calculationsContexts[0].CategoryBoundaryName); + CollectionAssert.AreEqual(locations.Select(loc => loc.DesignWaterLevelCalculation1), calculationsContexts[0].WrappedData); + Assert.AreEqual(signalingNorm / 30, calculationsContexts[0].GetNormFunc()); + + Assert.AreEqual("Categorie A->B", calculationsContexts[1].CategoryBoundaryName); + CollectionAssert.AreEqual(locations.Select(loc => loc.DesignWaterLevelCalculation2), calculationsContexts[1].WrappedData); + Assert.AreEqual(signalingNorm, calculationsContexts[1].GetNormFunc()); + + Assert.AreEqual("Categorie B->C", calculationsContexts[2].CategoryBoundaryName); + CollectionAssert.AreEqual(locations.Select(loc => loc.DesignWaterLevelCalculation3), calculationsContexts[2].WrappedData); + Assert.AreEqual(lowerLimitNorm, calculationsContexts[2].GetNormFunc()); + + Assert.AreEqual("Categorie C->D", calculationsContexts[3].CategoryBoundaryName); + CollectionAssert.AreEqual(locations.Select(loc => loc.DesignWaterLevelCalculation4), calculationsContexts[3].WrappedData); + Assert.AreEqual(lowerLimitNorm * 30, calculationsContexts[3].GetNormFunc()); + } + + mocks.VerifyAll(); + } + + private static TreeNodeInfo GetInfo(RingtoetsPlugin plugin) + { + return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(DesignWaterLevelCalculationsGroupContext)); + } + } +} \ No newline at end of file Fisheye: Tag f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelLocationsGroupContextTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs =================================================================== diff -u -ra1a8a692616323e706458111e9dc881f60ee5daa -rf8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision a1a8a692616323e706458111e9dc881f60ee5daa) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -261,13 +261,13 @@ // Assert Assert.AreEqual(2, objects.Length); - var designWaterLevelLocationsGroupContext = (DesignWaterLevelLocationsGroupContext) objects[0]; - Assert.AreSame(assessmentSection.HydraulicBoundaryDatabase.Locations, designWaterLevelLocationsGroupContext.WrappedData); - Assert.AreSame(assessmentSection, designWaterLevelLocationsGroupContext.AssessmentSection); + var designWaterLevelCalculationsGroupContext = (DesignWaterLevelCalculationsGroupContext) objects[0]; + Assert.AreSame(assessmentSection.HydraulicBoundaryDatabase.Locations, designWaterLevelCalculationsGroupContext.WrappedData); + Assert.AreSame(assessmentSection, designWaterLevelCalculationsGroupContext.AssessmentSection); - var waveHeightLocationsGroupContext = (WaveHeightLocationsGroupContext) objects[1]; - Assert.AreSame(assessmentSection.HydraulicBoundaryDatabase.Locations, waveHeightLocationsGroupContext.WrappedData); - Assert.AreSame(assessmentSection, waveHeightLocationsGroupContext.AssessmentSection); + var waveHeightCalculationsGroupContext = (WaveHeightCalculationsGroupContext) objects[1]; + Assert.AreSame(assessmentSection.HydraulicBoundaryDatabase.Locations, waveHeightCalculationsGroupContext.WrappedData); + Assert.AreSame(assessmentSection, waveHeightCalculationsGroupContext.AssessmentSection); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/WaveHeightCalculationsGroupContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/WaveHeightCalculationsGroupContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/WaveHeightCalculationsGroupContextTreeNodeInfoTest.cs (revision f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b) @@ -0,0 +1,210 @@ +// Copyright (C) Stichting Deltares 2017. 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.Base; +using Core.Common.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.ContextMenu; +using Core.Common.TestUtil; +using NUnit.Extensions.Forms; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Contribution; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Integration.Forms.PresentationObjects; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Plugin.Test.TreeNodeInfos +{ + [TestFixture] + public class WaveHeightCalculationsGroupContextTreeNodeInfoTest : NUnitFormTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // 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.IsNotNull(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_ReturnsSetName() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + string text = info.Text(null); + + // Assert + const string expectedName = "Golfhoogtes"; + Assert.AreEqual(expectedName, text); + } + } + + [Test] + public void Image_Always_ReturnsGeneralFolderIcon() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + Image image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GeneralFolderIcon, image); + } + } + + [Test] + public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.StrictMock(); + var menuBuilder = mockRepository.StrictMock(); + + using (mockRepository.Ordered()) + { + menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.Build()).Return(null); + } + + var nodeData = new WaveHeightCalculationsGroupContext(new ObservableList(), + assessmentSection); + + using (var treeViewControl = new TreeViewControl()) + { + var gui = mockRepository.Stub(); + gui.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); + mockRepository.ReplayAll(); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(nodeData, null, treeViewControl); + } + } + + // Assert + mockRepository.VerifyAll(); + } + + [Test] + public void ChildNodeObjects_Always_ReturnsChildrenOfData() + { + // Setup + const double signalingNorm = 0.002; + const double lowerLimitNorm = 0.005; + + var mocks = new MockRepository(); + var assessmentSection = mocks.StrictMock(); + assessmentSection.Expect(a => a.FailureMechanismContribution) + .Return(new FailureMechanismContribution( + Enumerable.Empty(), + 10, + lowerLimitNorm, + signalingNorm)) + .Repeat.Any(); + + mocks.ReplayAll(); + + var locations = new ObservableList(); + var calculationsGroupContext = new WaveHeightCalculationsGroupContext(locations, assessmentSection); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + object[] childNodeObjects = info.ChildNodeObjects(calculationsGroupContext); + + // Assert + Assert.AreEqual(4, childNodeObjects.Length); + + WaveHeightCalculationsContext[] calculationsContexts = childNodeObjects.OfType().ToArray(); + Assert.AreEqual(4, calculationsContexts.Length); + + Assert.IsTrue(calculationsContexts.All(c => ReferenceEquals(assessmentSection, c.AssessmentSection))); + + Assert.AreEqual("Categorie A+->A", calculationsContexts[0].CategoryBoundaryName); + CollectionAssert.AreEqual(locations.Select(loc => loc.WaveHeightCalculation1), calculationsContexts[0].WrappedData); + Assert.AreEqual(signalingNorm / 30, calculationsContexts[0].GetNormFunc()); + + Assert.AreEqual("Categorie A->B", calculationsContexts[1].CategoryBoundaryName); + CollectionAssert.AreEqual(locations.Select(loc => loc.WaveHeightCalculation2), calculationsContexts[1].WrappedData); + Assert.AreEqual(signalingNorm, calculationsContexts[1].GetNormFunc()); + + Assert.AreEqual("Categorie B->C", calculationsContexts[2].CategoryBoundaryName); + CollectionAssert.AreEqual(locations.Select(loc => loc.WaveHeightCalculation3), calculationsContexts[2].WrappedData); + Assert.AreEqual(lowerLimitNorm, calculationsContexts[2].GetNormFunc()); + + Assert.AreEqual("Categorie C->D", calculationsContexts[3].CategoryBoundaryName); + CollectionAssert.AreEqual(locations.Select(loc => loc.WaveHeightCalculation4), calculationsContexts[3].WrappedData); + Assert.AreEqual(lowerLimitNorm * 30, calculationsContexts[3].GetNormFunc()); + } + + mocks.VerifyAll(); + } + + private static TreeNodeInfo GetInfo(RingtoetsPlugin plugin) + { + return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(WaveHeightCalculationsGroupContext)); + } + } +} \ No newline at end of file Fisheye: Tag f8f82b94a5b6a3a47b2b32fc1a8ab704b33f356b refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/WaveHeightLocationsGroupContextTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff?