Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CalculatableRow.cs
===================================================================
diff -u -rb74aa4c8b4b8995197d3252cc299835b7e57fc47 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CalculatableRow.cs (.../CalculatableRow.cs) (revision b74aa4c8b4b8995197d3252cc299835b7e57fc47)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CalculatableRow.cs (.../CalculatableRow.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -19,16 +19,39 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
+
namespace Ringtoets.Common.Forms.Views
{
///
/// This class represents a row that has data that can be calculated.
///
- public abstract class CalculatableRow
+ /// The type of the calculatable object.
+ public abstract class CalculatableRow where T : class
{
///
- /// Gets or sets whether the is set to be calculated.
+ /// Creates a new instance of .
///
+ /// The calculatable object to wrap.
+ /// Thrown when
+ /// is null.
+ protected CalculatableRow(T calculatableObject)
+ {
+ if (calculatableObject == null)
+ {
+ throw new ArgumentNullException(nameof(calculatableObject));
+ }
+ CalculatableObject = calculatableObject;
+ }
+
+ ///
+ /// Gets or sets whether the is set to be calculated.
+ ///
public bool ToCalculate { get; set; }
+
+ ///
+ /// Gets the wrapped calculatable object.
+ ///
+ public T CalculatableObject { get; }
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CalculatableView.Designer.cs
===================================================================
diff -u -rb9d3e9f07eb3d45c0b608fc219982c4ddec05d6a -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CalculatableView.Designer.cs (.../CalculatableView.Designer.cs) (revision b9d3e9f07eb3d45c0b608fc219982c4ddec05d6a)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CalculatableView.Designer.cs (.../CalculatableView.Designer.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -1,6 +1,6 @@
namespace Ringtoets.Common.Forms.Views
{
- partial class CalculatableView
+ partial class CalculatableView
{
///
/// Required designer variable.
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CalculatableView.cs
===================================================================
diff -u -rb9d3e9f07eb3d45c0b608fc219982c4ddec05d6a -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CalculatableView.cs (.../CalculatableView.cs) (revision b9d3e9f07eb3d45c0b608fc219982c4ddec05d6a)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/CalculatableView.cs (.../CalculatableView.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -35,14 +35,15 @@
/// Base view for calculatable objects such as views
/// which should be derived in order to get a consistent look and feel.
///
- public abstract partial class CalculatableView : UserControl, ISelectionProvider
+ /// The type of the calculatable object.
+ public abstract partial class CalculatableView : UserControl, ISelectionProvider where T : class
{
private const int calculateColumnIndex = 0;
private bool updatingDataSource;
public event EventHandler SelectionChanged;
///
- /// Creates a new instance of .
+ /// Creates a new instance of .
///
protected CalculatableView()
{
@@ -93,7 +94,7 @@
///
protected virtual void InitializeDataGridView()
{
- dataGridViewControl.AddCheckBoxColumn(TypeUtils.GetMemberName(row => row.ToCalculate),
+ dataGridViewControl.AddCheckBoxColumn(TypeUtils.GetMemberName>(row => row.ToCalculate),
Resources.HydraulicBoundaryLocationsView_Calculate);
}
@@ -114,11 +115,25 @@
///
protected abstract void CalculateForSelectedRows();
- protected IEnumerable GetCalculatableRows()
+ ///
+ /// Gets all the row items from the .
+ ///
+ /// All row items from the .
+ protected IEnumerable> GetCalculatableRows()
{
- return dataGridViewControl.Rows.Cast().Select(row => (CalculatableRow) row.DataBoundItem);
+ return dataGridViewControl.Rows.Cast().Select(row => (CalculatableRow) row.DataBoundItem);
}
+ ///
+ /// Gets all the selected calculatable objects.
+ ///
+ ///
+ protected IEnumerable GetSelectedLocations()
+ {
+ return GetCalculatableRows().Where(r => r.ToCalculate)
+ .Select(r => r.CalculatableObject);
+ }
+
private void LocalizeControls()
{
CalculateForSelectedButton.Text = Resources.HydraulicBoundaryLocationsView_CalculateForSelectedButton_Text;
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/DesignWaterLevelLocationRow.cs
===================================================================
diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/DesignWaterLevelLocationRow.cs (.../DesignWaterLevelLocationRow.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/DesignWaterLevelLocationRow.cs (.../DesignWaterLevelLocationRow.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -38,7 +38,8 @@
///
/// The for this row.
/// Thrown when is null.
- public DesignWaterLevelLocationRow(HydraulicBoundaryLocation hydraulicBoundaryLocation) : base(hydraulicBoundaryLocation) {}
+ public DesignWaterLevelLocationRow(HydraulicBoundaryLocation hydraulicBoundaryLocation)
+ : base(hydraulicBoundaryLocation) {}
///
/// Gets the .
@@ -48,7 +49,7 @@
{
get
{
- return HydraulicBoundaryLocation.DesignWaterLevel;
+ return CalculatableObject.DesignWaterLevel;
}
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/HydraulicBoundaryLocationRow.cs
===================================================================
diff -u -ra52911c6ccb59303a68fb0fb981da90dd8902128 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/HydraulicBoundaryLocationRow.cs (.../HydraulicBoundaryLocationRow.cs) (revision a52911c6ccb59303a68fb0fb981da90dd8902128)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/HydraulicBoundaryLocationRow.cs (.../HydraulicBoundaryLocationRow.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -28,58 +28,46 @@
///
/// This class represents a row of .
///
- public abstract class HydraulicBoundaryLocationRow : CalculatableRow
+ public abstract class HydraulicBoundaryLocationRow : CalculatableRow
{
///
/// Creates a new instance of .
///
/// The for this row.
/// Thrown when is null.
protected HydraulicBoundaryLocationRow(HydraulicBoundaryLocation hydraulicBoundaryLocation)
- {
- if (hydraulicBoundaryLocation == null)
- {
- throw new ArgumentNullException(nameof(hydraulicBoundaryLocation));
- }
+ : base(hydraulicBoundaryLocation) {}
- HydraulicBoundaryLocation = hydraulicBoundaryLocation;
- }
-
///
- /// Gets the hydraulic boundaries location.
+ /// Gets the .
///
- public HydraulicBoundaryLocation HydraulicBoundaryLocation { get; }
-
- ///
- /// Gets the .
- ///
public string Name
{
get
{
- return HydraulicBoundaryLocation.Name;
+ return CalculatableObject.Name;
}
}
///
- /// Gets the .
+ /// Gets the .
///
public long Id
{
get
{
- return HydraulicBoundaryLocation.Id;
+ return CalculatableObject.Id;
}
}
///
- /// Gets the .
+ /// Gets the .
///
public Point2D Location
{
get
{
- return HydraulicBoundaryLocation.Location;
+ return CalculatableObject.Location;
}
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/HydraulicBoundaryLocationsView.cs
===================================================================
diff -u -rb9d3e9f07eb3d45c0b608fc219982c4ddec05d6a -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/HydraulicBoundaryLocationsView.cs (.../HydraulicBoundaryLocationsView.cs) (revision b9d3e9f07eb3d45c0b608fc219982c4ddec05d6a)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/HydraulicBoundaryLocationsView.cs (.../HydraulicBoundaryLocationsView.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -34,7 +34,7 @@
/// Base view for views which should be derived in order to get a consistent look and feel.
///
/// The type of the row objects which are shown in the data table.
- public abstract partial class HydraulicBoundaryLocationsView : CalculatableView where T : HydraulicBoundaryLocationRow
+ public abstract partial class HydraulicBoundaryLocationsView : CalculatableView where T : HydraulicBoundaryLocationRow
{
private IEnumerable locations;
@@ -95,7 +95,7 @@
return;
}
- var selectedLocations = GetSelectedHydraulicBoundaryLocationContext();
+ var selectedLocations = GetSelectedLocations();
HandleCalculateSelectedLocations(selectedLocations);
}
@@ -106,12 +106,5 @@
{
dataGridViewControl.SetDataSource(locations?.Select(CreateNewRow).ToArray());
}
-
- private IEnumerable GetSelectedHydraulicBoundaryLocationContext()
- {
- return GetCalculatableRows().Where(r => r.ToCalculate)
- .Cast()
- .Select(r => r.HydraulicBoundaryLocation);
- }
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/WaveHeightLocationRow.cs
===================================================================
diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/WaveHeightLocationRow.cs (.../WaveHeightLocationRow.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/WaveHeightLocationRow.cs (.../WaveHeightLocationRow.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -38,7 +38,8 @@
///
/// The for this row.
/// Thrown when is null.
- public WaveHeightLocationRow(HydraulicBoundaryLocation hydraulicBoundaryLocation) : base(hydraulicBoundaryLocation) {}
+ public WaveHeightLocationRow(HydraulicBoundaryLocation hydraulicBoundaryLocation)
+ : base(hydraulicBoundaryLocation) {}
///
/// Gets the .
@@ -48,7 +49,7 @@
{
get
{
- return HydraulicBoundaryLocation.WaveHeight;
+ return CalculatableObject.WaveHeight;
}
}
}
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/CalculatableRowTest.cs
===================================================================
diff -u -rb74aa4c8b4b8995197d3252cc299835b7e57fc47 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/CalculatableRowTest.cs (.../CalculatableRowTest.cs) (revision b74aa4c8b4b8995197d3252cc299835b7e57fc47)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/CalculatableRowTest.cs (.../CalculatableRowTest.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -19,7 +19,10 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Forms.Views;
namespace Ringtoets.Common.Forms.Test.Views
@@ -28,18 +31,33 @@
public class CalculatableRowTest
{
[Test]
- public void Constructor_Property_SetPropertyAsExpected()
+ public void Constructor_CalculatableObjectNull_ThrowArgumentNullException()
{
+ // Call
+ TestDelegate test = () => new SimpleCalculatableRow(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("calculatableObject", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
// Setup
- var row = new SimpleCalculatableRow();
+ var calculatableObject = new TestHydraulicBoundaryLocation();
// Call
- row.ToCalculate = true;
-
+ var row = new SimpleCalculatableRow(calculatableObject);
+
// Assert
- Assert.IsTrue(row.ToCalculate);
+ Assert.IsFalse(row.ToCalculate);
+ Assert.AreSame(calculatableObject, row.CalculatableObject);
}
- private class SimpleCalculatableRow : CalculatableRow {}
+ private class SimpleCalculatableRow : CalculatableRow {
+ public SimpleCalculatableRow(HydraulicBoundaryLocation calculatableObject)
+ : base(calculatableObject) {}
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/CalculatableViewTest.cs
===================================================================
diff -u -rb9d3e9f07eb3d45c0b608fc219982c4ddec05d6a -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/CalculatableViewTest.cs (.../CalculatableViewTest.cs) (revision b9d3e9f07eb3d45c0b608fc219982c4ddec05d6a)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/CalculatableViewTest.cs (.../CalculatableViewTest.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -232,23 +232,20 @@
return view;
}
- private class TestCalculatableRow : CalculatableRow
+ private class TestCalculatableRow : CalculatableRow
{
- public TestCalculatableRow(TestCalculatableObject calculatableObject)
+ public TestCalculatableRow(TestCalculatableObject calculatableObject) : base (calculatableObject)
{
- CalculatableObject = calculatableObject;
ToCalculate = calculatableObject.IsChecked;
}
-
- public TestCalculatableObject CalculatableObject { get; }
}
private class TestCalculatableObject
{
public bool IsChecked { get; }
}
- private class TestCalculatableView : CalculatableView
+ private class TestCalculatableView : CalculatableView
{
private IEnumerable data;
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/DesignWaterLevelLocationRowTest.cs
===================================================================
diff -u -r8dcb8c0fa8992c488bdea7d0631c84b7b1b09e61 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/DesignWaterLevelLocationRowTest.cs (.../DesignWaterLevelLocationRowTest.cs) (revision 8dcb8c0fa8992c488bdea7d0631c84b7b1b09e61)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/DesignWaterLevelLocationRowTest.cs (.../DesignWaterLevelLocationRowTest.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -19,7 +19,6 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using System;
using Core.Common.Utils.Reflection;
using NUnit.Framework;
using Ringtoets.Common.Data.Hydraulics;
@@ -33,17 +32,6 @@
public class DesignWaterLevelLocationRowTest
{
[Test]
- public void Constructor_WithoutDesignWaterLevelLocationContext_ThrowsArgumentNullException()
- {
- // Call
- TestDelegate test = () => new DesignWaterLevelLocationRow(null);
-
- // Assert
- string paramName = Assert.Throws(test).ParamName;
- Assert.AreEqual("hydraulicBoundaryLocation", paramName);
- }
-
- [Test]
public void Constructor_WithDesignWaterLevelLocationContext_PropertiesFromHydraulicBoundaryLocation()
{
// Setup
@@ -60,7 +48,7 @@
Assert.AreEqual(hydraulicBoundaryLocation.Name, row.Name);
Assert.AreEqual(designWaterLevel, row.DesignWaterLevel, hydraulicBoundaryLocation.DesignWaterLevel.GetAccuracy());
Assert.AreEqual(hydraulicBoundaryLocation.Location, row.Location);
- Assert.AreSame(hydraulicBoundaryLocation, row.HydraulicBoundaryLocation);
+ Assert.AreSame(hydraulicBoundaryLocation, row.CalculatableObject);
Assert.IsFalse(row.ToCalculate);
Assert.IsTrue(TypeUtils.HasTypeConverter(r => r.DesignWaterLevel));
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/HydraulicBoundaryLocationRowTest.cs
===================================================================
diff -u -ra52911c6ccb59303a68fb0fb981da90dd8902128 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/HydraulicBoundaryLocationRowTest.cs (.../HydraulicBoundaryLocationRowTest.cs) (revision a52911c6ccb59303a68fb0fb981da90dd8902128)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/HydraulicBoundaryLocationRowTest.cs (.../HydraulicBoundaryLocationRowTest.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -19,7 +19,6 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using System;
using Core.Common.Base.Geometry;
using NUnit.Framework;
using Ringtoets.Common.Data.Hydraulics;
@@ -31,17 +30,6 @@
public class HydraulicBoundaryLocationRowTest
{
[Test]
- public void Constructor_WithoutHydraulicBoundaryLocationContext_ThrowsArgumentNullException()
- {
- // Call
- TestDelegate test = () => new TestHydraulicBoundaryLocationRow(null);
-
- // Assert
- string paramName = Assert.Throws(test).ParamName;
- Assert.AreEqual("hydraulicBoundaryLocation", paramName);
- }
-
- [Test]
public void Constructor_WithHydraulicBoundaryLocationContext_PropertiesFromHydraulicBoundaryLocation()
{
// Setup
@@ -55,12 +43,12 @@
var row = new TestHydraulicBoundaryLocationRow(hydraulicBoundaryLocation);
// Assert
- Assert.IsInstanceOf(row);
+ Assert.IsInstanceOf>(row);
Assert.AreEqual(id, row.Id);
Assert.AreEqual(locationname, row.Name);
var expectedPoint2D = new Point2D(coordinateX, coordinateY);
Assert.AreEqual(expectedPoint2D, row.Location);
- Assert.AreSame(hydraulicBoundaryLocation, row.HydraulicBoundaryLocation);
+ Assert.AreSame(hydraulicBoundaryLocation, row.CalculatableObject);
Assert.IsFalse(row.ToCalculate);
}
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/HydraulicBoundaryLocationsViewTest.cs
===================================================================
diff -u -r3722e29f53ce7db0f11fb184cdc2a76d33078cf2 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/HydraulicBoundaryLocationsViewTest.cs (.../HydraulicBoundaryLocationsViewTest.cs) (revision 3722e29f53ce7db0f11fb184cdc2a76d33078cf2)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/HydraulicBoundaryLocationsViewTest.cs (.../HydraulicBoundaryLocationsViewTest.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -61,7 +61,7 @@
using (var view = new TestHydraulicBoundaryLocationsView())
{
// Assert
- Assert.IsInstanceOf(view);
+ Assert.IsInstanceOf>(view);
Assert.IsNull(view.Data);
}
}
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/WaveHeightLocationRowTest.cs
===================================================================
diff -u -r533cfb6b8d9c3e198204d1c6ee022b79049e6d43 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/WaveHeightLocationRowTest.cs (.../WaveHeightLocationRowTest.cs) (revision 533cfb6b8d9c3e198204d1c6ee022b79049e6d43)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/WaveHeightLocationRowTest.cs (.../WaveHeightLocationRowTest.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -19,7 +19,6 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using System;
using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
using Core.Common.Utils.Reflection;
@@ -35,17 +34,6 @@
public class WaveHeightLocationRowTest
{
[Test]
- public void Constructor_WithoutWaveHeightLocationContext_ThrowsArgumentNullException()
- {
- // Call
- TestDelegate test = () => new WaveHeightLocationRow(null);
-
- // Assert
- string paramName = Assert.Throws(test).ParamName;
- Assert.AreEqual("hydraulicBoundaryLocation", paramName);
- }
-
- [Test]
public void Constructor_WithWaveHeightLocationContext_PropertiesFromHydraulicBoundaryLocation()
{
// Setup
@@ -69,7 +57,7 @@
Assert.AreEqual(waveHeight, row.WaveHeight, hydraulicBoundaryLocation.WaveHeight.GetAccuracy());
var expectedPoint2D = new Point2D(coordinateX, coordinateY);
Assert.AreEqual(expectedPoint2D, row.Location);
- Assert.AreSame(hydraulicBoundaryLocation, row.HydraulicBoundaryLocation);
+ Assert.AreSame(hydraulicBoundaryLocation, row.CalculatableObject);
Assert.IsFalse(row.ToCalculate);
Assert.IsTrue(TypeUtils.HasTypeConverter(r => r.WaveHeight));
Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationRow.cs
===================================================================
diff -u -r714cfe37b354d87e8dee4a6d78de0a4c4615b6d6 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationRow.cs (.../DuneLocationRow.cs) (revision 714cfe37b354d87e8dee4a6d78de0a4c4615b6d6)
+++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationRow.cs (.../DuneLocationRow.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -34,80 +34,68 @@
///
/// This class represents a row of .
///
- public class DuneLocationRow : CalculatableRow
+ public class DuneLocationRow : CalculatableRow
{
///
/// Creates a new instance of .
///
/// The to wrap.
/// Thrown when is null.
public DuneLocationRow(DuneLocation duneLocation)
- {
- if (duneLocation == null)
- {
- throw new ArgumentNullException(nameof(duneLocation));
- }
+ : base(duneLocation) {}
- DuneLocation = duneLocation;
- }
-
///
- /// Gets the wrapped .
+ /// Gets the .
///
- public DuneLocation DuneLocation { get; }
-
- ///
- /// Gets the .
- ///
public string Name
{
get
{
- return DuneLocation.Name;
+ return CalculatableObject.Name;
}
}
///
- /// Gets the .
+ /// Gets the .
///
public long Id
{
get
{
- return DuneLocation.Id;
+ return CalculatableObject.Id;
}
}
///
- /// Gets the .
+ /// Gets the .
///
public Point2D Location
{
get
{
- return DuneLocation.Location;
+ return CalculatableObject.Location;
}
}
///
- /// Gets the .
+ /// Gets the .
///
public int CoastalAreaId
{
get
{
- return DuneLocation.CoastalAreaId;
+ return CalculatableObject.CoastalAreaId;
}
}
///
- /// Gets the .
+ /// Gets the .
///
public string Offset
{
get
{
- return DuneLocation.Offset.ToString(DuneErosionDataResources.DuneLocation_Offset_format, CultureInfo.InvariantCulture);
+ return CalculatableObject.Offset.ToString(DuneErosionDataResources.DuneLocation_Offset_format, CultureInfo.InvariantCulture);
}
}
@@ -119,7 +107,7 @@
{
get
{
- return DuneLocation.Output?.WaterLevel ?? RoundedDouble.NaN;
+ return CalculatableObject.Output?.WaterLevel ?? RoundedDouble.NaN;
}
}
@@ -131,7 +119,7 @@
{
get
{
- return DuneLocation.Output?.WaveHeight ?? RoundedDouble.NaN;
+ return CalculatableObject.Output?.WaveHeight ?? RoundedDouble.NaN;
}
}
@@ -143,18 +131,18 @@
{
get
{
- return DuneLocation.Output?.WavePeriod ?? RoundedDouble.NaN;
+ return CalculatableObject.Output?.WavePeriod ?? RoundedDouble.NaN;
}
}
///
- /// Gets the .
+ /// Gets the .
///
public RoundedDouble D50
{
get
{
- return DuneLocation.D50;
+ return CalculatableObject.D50;
}
}
}
Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsView.cs
===================================================================
diff -u -r90fb0bee68ae22094e4ef328dc563985f63365fe -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsView.cs (.../DuneLocationsView.cs) (revision 90fb0bee68ae22094e4ef328dc563985f63365fe)
+++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsView.cs (.../DuneLocationsView.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -36,7 +36,7 @@
///
/// View for the .
///
- public partial class DuneLocationsView : CalculatableView
+ public partial class DuneLocationsView : CalculatableView
{
private readonly Observer duneLocationsObserver;
private IEnumerable locations;
@@ -116,7 +116,7 @@
{
var currentRow = dataGridViewControl.CurrentRow;
return currentRow != null
- ? new DuneLocationContext((ObservableList) Data, ((DuneLocationRow) currentRow.DataBoundItem).DuneLocation)
+ ? new DuneLocationContext((ObservableList) Data, ((DuneLocationRow) currentRow.DataBoundItem).CalculatableObject)
: null;
}
@@ -145,13 +145,6 @@
((IObservable) Data).NotifyObservers();
}
- private IEnumerable GetSelectedLocations()
- {
- return GetCalculatableRows().Where(r => r.ToCalculate)
- .Cast()
- .Select(r => r.DuneLocation);
- }
-
private void UpdateDuneLocations()
{
if (IsDataGridDataSourceChanged())
@@ -173,7 +166,7 @@
}
for (int i = 0; i < count; i++)
{
- var locationFromGrid = ((DuneLocationRow) dataGridViewControl.Rows[i].DataBoundItem).DuneLocation;
+ var locationFromGrid = ((DuneLocationRow) dataGridViewControl.Rows[i].DataBoundItem).CalculatableObject;
if (!ReferenceEquals(locationFromGrid, locations.ElementAt(i)))
{
return true;
Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationRowTest.cs
===================================================================
diff -u -rc824c971119bfdb785a6b1641a821fe344f22869 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationRowTest.cs (.../DuneLocationRowTest.cs) (revision c824c971119bfdb785a6b1641a821fe344f22869)
+++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationRowTest.cs (.../DuneLocationRowTest.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -19,7 +19,6 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using System;
using System.Globalization;
using Core.Common.Base.Geometry;
using Core.Common.Utils.Reflection;
@@ -36,17 +35,6 @@
public class DuneLocationRowTest
{
[Test]
- public void Constructor_DuneLocationNull_ThrowArgumentNullException()
- {
- // Call
- TestDelegate test = () => new DuneLocationRow(null);
-
- // Assert
- var exception = Assert.Throws(test);
- Assert.AreEqual("duneLocation", exception.ParamName);
- }
-
- [Test]
[TestCase(34.1)]
[TestCase(34.0)]
public void Constructor_WithOutput_ExpectedValues(double offSet)
@@ -71,8 +59,8 @@
var row = new DuneLocationRow(location);
// Assert
- Assert.IsInstanceOf(row);
- Assert.AreSame(location, row.DuneLocation);
+ Assert.IsInstanceOf>(row);
+ Assert.AreSame(location, row.CalculatableObject);
Assert.AreEqual(location.Id, row.Id);
Assert.AreEqual(location.Name, row.Name);
Assert.AreSame(location.Location, row.Location);
Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationsViewTest.cs
===================================================================
diff -u -r90fb0bee68ae22094e4ef328dc563985f63365fe -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationsViewTest.cs (.../DuneLocationsViewTest.cs) (revision 90fb0bee68ae22094e4ef328dc563985f63365fe)
+++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationsViewTest.cs (.../DuneLocationsViewTest.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -80,7 +80,7 @@
using (var view = new DuneLocationsView())
{
// Assert
- Assert.IsInstanceOf(view);
+ Assert.IsInstanceOf>(view);
Assert.IsNull(view.Data);
}
}
@@ -226,7 +226,7 @@
Assert.NotNull(selection);
Assert.NotNull(dataBoundItem);
- Assert.AreSame(dataBoundItem.DuneLocation, selection.DuneLocation);
+ Assert.AreSame(dataBoundItem.CalculatableObject, selection.DuneLocation);
}
}
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsDesignWaterLevelLocationsView.cs
===================================================================
diff -u -r8b1f55193a7e6565f7e837bcf67f77c60eacf94b -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsDesignWaterLevelLocationsView.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsView.cs) (revision 8b1f55193a7e6565f7e837bcf67f77c60eacf94b)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsDesignWaterLevelLocationsView.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsView.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -89,13 +89,14 @@
var currentRow = dataGridViewControl.CurrentRow;
return currentRow != null ?
- new GrassCoverErosionOutwardsDesignWaterLevelLocationContext((ObservableList) Data, ((HydraulicBoundaryLocationRow) currentRow.DataBoundItem).HydraulicBoundaryLocation) :
+ new GrassCoverErosionOutwardsDesignWaterLevelLocationContext((ObservableList) Data,
+ ((HydraulicBoundaryLocationRow) currentRow.DataBoundItem).CalculatableObject) :
null;
}
protected override void HandleCalculateSelectedLocations(IEnumerable locations)
{
- if (AssessmentSection == null || AssessmentSection.HydraulicBoundaryDatabase == null)
+ if (AssessmentSection?.HydraulicBoundaryDatabase == null)
{
return;
}
@@ -138,7 +139,7 @@
}
for (int i = 0; i < count; i++)
{
- var locationFromGrid = ((DesignWaterLevelLocationRow) dataGridViewControl.Rows[i].DataBoundItem).HydraulicBoundaryLocation;
+ var locationFromGrid = ((DesignWaterLevelLocationRow) dataGridViewControl.Rows[i].DataBoundItem).CalculatableObject;
if (!ReferenceEquals(locationFromGrid, locations[i]))
{
return true;
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsWaveHeightLocationsView.cs
===================================================================
diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsWaveHeightLocationsView.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsView.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsWaveHeightLocationsView.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsView.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -81,15 +81,15 @@
{
var currentRow = dataGridViewControl.CurrentRow;
- return currentRow != null ?
- new GrassCoverErosionOutwardsWaveHeightLocationContext((ObservableList) Data,
- ((WaveHeightLocationRow) currentRow.DataBoundItem).HydraulicBoundaryLocation) :
- null;
+ return currentRow != null
+ ? new GrassCoverErosionOutwardsWaveHeightLocationContext((ObservableList) Data,
+ ((WaveHeightLocationRow) currentRow.DataBoundItem).CalculatableObject)
+ : null;
}
protected override void HandleCalculateSelectedLocations(IEnumerable locations)
{
- if (AssessmentSection == null || AssessmentSection.HydraulicBoundaryDatabase == null)
+ if (AssessmentSection?.HydraulicBoundaryDatabase == null)
{
return;
}
@@ -146,7 +146,7 @@
}
for (int i = 0; i < count; i++)
{
- var locationFromGrid = ((WaveHeightLocationRow) dataGridViewControl.Rows[i].DataBoundItem).HydraulicBoundaryLocation;
+ var locationFromGrid = ((WaveHeightLocationRow) dataGridViewControl.Rows[i].DataBoundItem).CalculatableObject;
if (!ReferenceEquals(locationFromGrid, locations[i]))
{
return true;
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs
===================================================================
diff -u -r8b1f55193a7e6565f7e837bcf67f77c60eacf94b -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs) (revision 8b1f55193a7e6565f7e837bcf67f77c60eacf94b)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -106,7 +106,7 @@
Assert.NotNull(selection);
Assert.NotNull(dataBoundItem);
- Assert.AreSame(dataBoundItem.HydraulicBoundaryLocation, selection.HydraulicBoundaryLocation);
+ Assert.AreSame(dataBoundItem.CalculatableObject, selection.HydraulicBoundaryLocation);
}
}
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsWaveHeightLocationsViewTest.cs
===================================================================
diff -u -r533cfb6b8d9c3e198204d1c6ee022b79049e6d43 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsWaveHeightLocationsViewTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsViewTest.cs) (revision 533cfb6b8d9c3e198204d1c6ee022b79049e6d43)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsWaveHeightLocationsViewTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsViewTest.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -106,7 +106,7 @@
Assert.NotNull(selection);
Assert.NotNull(dataBoundItem);
- Assert.AreSame(dataBoundItem.HydraulicBoundaryLocation, selection.HydraulicBoundaryLocation);
+ Assert.AreSame(dataBoundItem.CalculatableObject, selection.HydraulicBoundaryLocation);
}
}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs
===================================================================
diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs (.../DesignWaterLevelLocationsView.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/DesignWaterLevelLocationsView.cs (.../DesignWaterLevelLocationsView.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -73,14 +73,15 @@
{
var currentRow = dataGridViewControl.CurrentRow;
- return currentRow != null ?
- new DesignWaterLevelLocationContext(AssessmentSection.HydraulicBoundaryDatabase, ((HydraulicBoundaryLocationRow) currentRow.DataBoundItem).HydraulicBoundaryLocation) :
- null;
+ return currentRow != null
+ ? new DesignWaterLevelLocationContext(AssessmentSection.HydraulicBoundaryDatabase,
+ ((HydraulicBoundaryLocationRow) currentRow.DataBoundItem).CalculatableObject)
+ : null;
}
protected override void HandleCalculateSelectedLocations(IEnumerable locations)
{
- if (AssessmentSection == null || AssessmentSection.HydraulicBoundaryDatabase == null)
+ if (AssessmentSection?.HydraulicBoundaryDatabase == null)
{
return;
}
@@ -116,7 +117,7 @@
private void UpdateHydraulicBoundaryDatabase()
{
- if (AssessmentSection == null || AssessmentSection.HydraulicBoundaryDatabase == null)
+ if (AssessmentSection?.HydraulicBoundaryDatabase == null)
{
hydraulicBoundaryDatabaseObserver.Observable = null;
Data = null;
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs
===================================================================
diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs (.../WaveHeightLocationsView.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WaveHeightLocationsView.cs (.../WaveHeightLocationsView.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -73,14 +73,15 @@
{
var currentRow = dataGridViewControl.CurrentRow;
- return currentRow != null ?
- new WaveHeightLocationContext(AssessmentSection.HydraulicBoundaryDatabase, ((HydraulicBoundaryLocationRow) currentRow.DataBoundItem).HydraulicBoundaryLocation) :
- null;
+ return currentRow != null
+ ? new WaveHeightLocationContext(AssessmentSection.HydraulicBoundaryDatabase,
+ ((HydraulicBoundaryLocationRow) currentRow.DataBoundItem).CalculatableObject)
+ : null;
}
protected override void HandleCalculateSelectedLocations(IEnumerable locations)
{
- if (AssessmentSection == null || AssessmentSection.HydraulicBoundaryDatabase == null)
+ if (AssessmentSection?.HydraulicBoundaryDatabase == null)
{
return;
}
@@ -118,7 +119,7 @@
private void UpdateHydraulicBoundaryDatabase()
{
- if (AssessmentSection == null || AssessmentSection.HydraulicBoundaryDatabase == null)
+ if (AssessmentSection?.HydraulicBoundaryDatabase == null)
{
hydraulicBoundaryDatabaseObserver.Observable = null;
Data = null;
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs
===================================================================
diff -u -r3722e29f53ce7db0f11fb184cdc2a76d33078cf2 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs (.../DesignWaterLevelLocationsViewTest.cs) (revision 3722e29f53ce7db0f11fb184cdc2a76d33078cf2)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/DesignWaterLevelLocationsViewTest.cs (.../DesignWaterLevelLocationsViewTest.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -101,7 +101,7 @@
Assert.NotNull(selection);
Assert.NotNull(dataBoundItem);
- Assert.AreSame(dataBoundItem.HydraulicBoundaryLocation, selection.HydraulicBoundaryLocation);
+ Assert.AreSame(dataBoundItem.CalculatableObject, selection.HydraulicBoundaryLocation);
}
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs
===================================================================
diff -u -r3722e29f53ce7db0f11fb184cdc2a76d33078cf2 -re468a5451f59115ec6ca32c014da1baaa38866e8
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs (.../WaveHeightLocationsViewTest.cs) (revision 3722e29f53ce7db0f11fb184cdc2a76d33078cf2)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WaveHeightLocationsViewTest.cs (.../WaveHeightLocationsViewTest.cs) (revision e468a5451f59115ec6ca32c014da1baaa38866e8)
@@ -99,7 +99,7 @@
Assert.NotNull(selection);
Assert.NotNull(dataBoundItem);
- Assert.AreSame(dataBoundItem.HydraulicBoundaryLocation, selection.HydraulicBoundaryLocation);
+ Assert.AreSame(dataBoundItem.CalculatableObject, selection.HydraulicBoundaryLocation);
}
}