Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/DesignWaterLevelCalculationsContext.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/DesignWaterLevelCalculationsContext.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/DesignWaterLevelCalculationsContext.cs (revision a6c8ce99232f4695f07c75d8bee5a7a101be46b3)
@@ -0,0 +1,104 @@
+// 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.Common.Forms.PresentationObjects
+{
+ ///
+ /// Presentation object for all data required to configure an enumeration of
+ /// with a design water level calculation result.
+ ///
+ public class DesignWaterLevelCalculationsContext : ObservableWrappedObjectContextBase>
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The calculations that the belongs to.
+ /// The that the belongs to.
+ /// for obtaining the norm to use during calculations.
+ /// The name of the category boundary.
+ /// Thrown when , or
+ /// is null.
+ /// Thrown when is null or empty.
+ public DesignWaterLevelCalculationsContext(IObservableEnumerable wrappedData,
+ IAssessmentSection assessmentSection,
+ Func getNormFunc,
+ string categoryBoundaryName)
+ : base(wrappedData)
+ {
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ if (getNormFunc == null)
+ {
+ throw new ArgumentNullException(nameof(getNormFunc));
+ }
+
+ if (string.IsNullOrEmpty(categoryBoundaryName))
+ {
+ throw new ArgumentException($"'{nameof(categoryBoundaryName)}' must have a value.");
+ }
+
+ AssessmentSection = assessmentSection;
+ GetNormFunc = getNormFunc;
+ CategoryBoundaryName = categoryBoundaryName;
+ }
+
+ ///
+ /// Gets the assessment section that the context belongs to.
+ ///
+ public IAssessmentSection AssessmentSection { get; }
+
+ ///
+ /// Gets the for obtaining the norm to use during calculations.
+ ///
+ public Func GetNormFunc { get; }
+
+ ///
+ /// Gets the name of the category boundary.
+ ///
+ public string CategoryBoundaryName { get; }
+
+ public override bool Equals(WrappedObjectContextBase> other)
+ {
+ return base.Equals(other)
+ && other is DesignWaterLevelCalculationsContext
+ && CategoryBoundaryName.Equals(((DesignWaterLevelCalculationsContext) other).CategoryBoundaryName);
+ }
+
+ public override bool Equals(object obj)
+ {
+ return Equals(obj as DesignWaterLevelCalculationsContext);
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode() ^ CategoryBoundaryName.GetHashCode();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj
===================================================================
diff -u -rc73f42107d579f53f42b523e163418e6993ae5bd -ra6c8ce99232f4695f07c75d8bee5a7a101be46b3
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision c73f42107d579f53f42b523e163418e6993ae5bd)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision a6c8ce99232f4695f07c75d8bee5a7a101be46b3)
@@ -38,6 +38,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/DesignWaterLevelCalculationsContextTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/DesignWaterLevelCalculationsContextTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/DesignWaterLevelCalculationsContextTest.cs (revision a6c8ce99232f4695f07c75d8bee5a7a101be46b3)
@@ -0,0 +1,197 @@
+// 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 System.Collections.Generic;
+using Core.Common.Base;
+using Core.Common.Controls.PresentationObjects;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Forms.PresentationObjects;
+
+namespace Ringtoets.Common.Forms.Test.PresentationObjects
+{
+ [TestFixture]
+ public class DesignWaterLevelCalculationsContextTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var assessmentSection = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ var calculations = new ObservableList();
+ Func getNormFunc = () => 0.01;
+ const string categoryBoundaryName = "Test name";
+
+ // Call
+ var context = new DesignWaterLevelCalculationsContext(calculations,
+ assessmentSection,
+ getNormFunc,
+ categoryBoundaryName);
+
+ // Assert
+ 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();
+ }
+
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new DesignWaterLevelCalculationsContext(new ObservableList(),
+ null,
+ () => 0.01,
+ "Test name");
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_GetNormFuncNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var assessmentSection = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ // Call
+ TestDelegate call = () => new DesignWaterLevelCalculationsContext(new ObservableList(),
+ assessmentSection,
+ null,
+ "Test name");
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("getNormFunc", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_CategoryBoundaryNameNull_ThrowsArgumentException()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var assessmentSection = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ // Call
+ TestDelegate call = () => new DesignWaterLevelCalculationsContext(new ObservableList(),
+ assessmentSection,
+ () => 0.01,
+ null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("'categoryBoundaryName' must have a value.", exception.Message);
+ }
+
+ [Test]
+ public void Constructor_CategoryBoundaryNameEmpty_ThrowsArgumentException()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var assessmentSection = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ // Call
+ TestDelegate call = () => new DesignWaterLevelCalculationsContext(new ObservableList(),
+ assessmentSection,
+ () => 0.01,
+ string.Empty);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("'categoryBoundaryName' must have a value.", exception.Message);
+ }
+
+ [TestFixture]
+ private class DesignWaterLevelCalculationsContextEqualsTest
+ : EqualsTestFixture
+ {
+ private static readonly MockRepository mocks = new MockRepository();
+
+ private static readonly IAssessmentSection assessmentSection = mocks.Stub();
+ private static readonly Func getNormFunc = () => 0.01;
+ private static readonly IObservableEnumerable hydraulicBoundaryLocationCalculations = new ObservableList();
+ private static readonly string categoryBoundaryName = "Test name";
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks.ReplayAll();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ mocks.VerifyAll();
+ }
+
+ protected override DesignWaterLevelCalculationsContext CreateObject()
+ {
+ return new DesignWaterLevelCalculationsContext(hydraulicBoundaryLocationCalculations,
+ assessmentSection,
+ getNormFunc,
+ categoryBoundaryName);
+ }
+
+ protected override DerivedDesignWaterLevelCalculationsContext CreateDerivedObject()
+ {
+ return new DerivedDesignWaterLevelCalculationsContext(hydraulicBoundaryLocationCalculations,
+ assessmentSection,
+ getNormFunc,
+ categoryBoundaryName);
+ }
+
+ private static IEnumerable GetUnequalTestCases()
+ {
+ yield return new TestCaseData(new DesignWaterLevelCalculationsContext(hydraulicBoundaryLocationCalculations,
+ assessmentSection,
+ getNormFunc,
+ "Other"))
+ .SetName("CategoryBoundaryName");
+ }
+ }
+
+ private class DerivedDesignWaterLevelCalculationsContext : DesignWaterLevelCalculationsContext
+ {
+ public DerivedDesignWaterLevelCalculationsContext(IObservableEnumerable wrappedData,
+ IAssessmentSection assessmentSection,
+ Func getNormFunc,
+ string categoryBoundaryName)
+ : base(wrappedData,
+ assessmentSection,
+ getNormFunc,
+ categoryBoundaryName) {}
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj
===================================================================
diff -u -rc73f42107d579f53f42b523e163418e6993ae5bd -ra6c8ce99232f4695f07c75d8bee5a7a101be46b3
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision c73f42107d579f53f42b523e163418e6993ae5bd)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision a6c8ce99232f4695f07c75d8bee5a7a101be46b3)
@@ -60,6 +60,7 @@
+
Fisheye: Tag a6c8ce99232f4695f07c75d8bee5a7a101be46b3 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelCalculationsContext.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj
===================================================================
diff -u -rf656ad7d168ebf3ac3a3e906ec8c8a88f9806ad9 -ra6c8ce99232f4695f07c75d8bee5a7a101be46b3
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision f656ad7d168ebf3ac3a3e906ec8c8a88f9806ad9)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision a6c8ce99232f4695f07c75d8bee5a7a101be46b3)
@@ -29,7 +29,6 @@
-
Fisheye: Tag a6c8ce99232f4695f07c75d8bee5a7a101be46b3 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/DesignWaterLevelCalculationsContextTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj
===================================================================
diff -u -rf656ad7d168ebf3ac3a3e906ec8c8a88f9806ad9 -ra6c8ce99232f4695f07c75d8bee5a7a101be46b3
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision f656ad7d168ebf3ac3a3e906ec8c8a88f9806ad9)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision a6c8ce99232f4695f07c75d8bee5a7a101be46b3)
@@ -48,7 +48,6 @@
-
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/DesignWaterLevelCalculationsContextPropertyInfoTest.cs
===================================================================
diff -u -raa9bd8cb8d845786765b7a59be9c9c29488ae598 -ra6c8ce99232f4695f07c75d8bee5a7a101be46b3
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/DesignWaterLevelCalculationsContextPropertyInfoTest.cs (.../DesignWaterLevelCalculationsContextPropertyInfoTest.cs) (revision aa9bd8cb8d845786765b7a59be9c9c29488ae598)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/DesignWaterLevelCalculationsContextPropertyInfoTest.cs (.../DesignWaterLevelCalculationsContextPropertyInfoTest.cs) (revision a6c8ce99232f4695f07c75d8bee5a7a101be46b3)
@@ -27,7 +27,7 @@
using Rhino.Mocks;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Hydraulics;
-using Ringtoets.Integration.Forms.PresentationObjects;
+using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Integration.Forms.PropertyClasses;
namespace Ringtoets.Integration.Plugin.Test.PropertyInfos
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelCalculationsContextTreeNodeInfoTest.cs
===================================================================
diff -u -r59a82ae3063f2dda858cc5cf43e25c224856d88d -ra6c8ce99232f4695f07c75d8bee5a7a101be46b3
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelCalculationsContextTreeNodeInfoTest.cs (.../DesignWaterLevelCalculationsContextTreeNodeInfoTest.cs) (revision 59a82ae3063f2dda858cc5cf43e25c224856d88d)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelCalculationsContextTreeNodeInfoTest.cs (.../DesignWaterLevelCalculationsContextTreeNodeInfoTest.cs) (revision a6c8ce99232f4695f07c75d8bee5a7a101be46b3)
@@ -40,12 +40,12 @@
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.Service.TestUtil;
using Ringtoets.HydraRing.Calculation.Calculator.Factory;
using Ringtoets.HydraRing.Calculation.Data.Input.Hydraulics;
using Ringtoets.HydraRing.Calculation.TestUtil.Calculator;
using Ringtoets.Integration.Data;
-using Ringtoets.Integration.Forms.PresentationObjects;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
namespace Ringtoets.Integration.Plugin.Test.TreeNodeInfos
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelCalculationsGroupContextTreeNodeInfoTest.cs
===================================================================
diff -u -r6f33b44599df032ecae3342b0aacd606a9e87c1f -ra6c8ce99232f4695f07c75d8bee5a7a101be46b3
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelCalculationsGroupContextTreeNodeInfoTest.cs (.../DesignWaterLevelCalculationsGroupContextTreeNodeInfoTest.cs) (revision 6f33b44599df032ecae3342b0aacd606a9e87c1f)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/DesignWaterLevelCalculationsGroupContextTreeNodeInfoTest.cs (.../DesignWaterLevelCalculationsGroupContextTreeNodeInfoTest.cs) (revision a6c8ce99232f4695f07c75d8bee5a7a101be46b3)
@@ -32,6 +32,7 @@
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Integration.Forms.PresentationObjects;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/DesignWaterLevelCalculationsViewInfoTest.cs
===================================================================
diff -u -r6f33b44599df032ecae3342b0aacd606a9e87c1f -ra6c8ce99232f4695f07c75d8bee5a7a101be46b3
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/DesignWaterLevelCalculationsViewInfoTest.cs (.../DesignWaterLevelCalculationsViewInfoTest.cs) (revision 6f33b44599df032ecae3342b0aacd606a9e87c1f)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/DesignWaterLevelCalculationsViewInfoTest.cs (.../DesignWaterLevelCalculationsViewInfoTest.cs) (revision a6c8ce99232f4695f07c75d8bee5a7a101be46b3)
@@ -38,8 +38,8 @@
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Forms.GuiServices;
+using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.Forms.TestUtil;
-using Ringtoets.Integration.Forms.PresentationObjects;
using Ringtoets.Integration.Forms.Views;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;