Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs
===================================================================
diff -u -r989be010778ab44a778d79f0e2d892343acf0c0d -r6c7fbd4def41c722f172d3e11329a9635d2f7ba1
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs (.../GrassCoverErosionInwardsInput.cs) (revision 989be010778ab44a778d79f0e2d892343acf0c0d)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs (.../GrassCoverErosionInwardsInput.cs) (revision 6c7fbd4def41c722f172d3e11329a9635d2f7ba1)
@@ -56,7 +56,7 @@
orientation = new RoundedDouble(orientationNumberOfDecimals);
dikeHeight = new RoundedDouble(2);
- SynchronizeDikeProfileParameters();
+ SynchronizeDikeProfileInput();
criticalFlowRate = new LogNormalDistribution(4)
{
@@ -79,7 +79,7 @@
set
{
dikeProfile = value;
- SynchronizeDikeProfileParameters();
+ SynchronizeDikeProfileInput();
}
}
@@ -168,6 +168,34 @@
///
public OvertoppingRateCalculationType OvertoppingRateCalculationType { get; set; }
+ ///
+ /// Gets the value true if the parameters of the instance of
+ /// that are derived from
+ /// match the properties of
+ /// ; or false if this is not the case,
+ /// or if there is no assigned.
+ ///
+ public bool IsDikeProfileInputSynchronized
+ {
+ get
+ {
+ if (dikeProfile == null)
+ {
+ return false;
+ }
+
+ BreakWater breakwater = dikeProfile.HasBreakWater
+ ? new BreakWater(dikeProfile.BreakWater.Type, dikeProfile.BreakWater.Height)
+ : GetDefaultBreakWater();
+
+ return Equals(UseBreakWater, dikeProfile.HasBreakWater)
+ && Equals(BreakWater, breakwater)
+ && Equals(Orientation, dikeProfile.Orientation)
+ && Equals(DikeHeight, dikeProfile.DikeHeight)
+ && UseForeshore == dikeProfile.ForeshoreGeometry.Count() > 1;
+ }
+ }
+
public bool UseBreakWater { get; set; }
public BreakWater BreakWater { get; private set; }
@@ -185,35 +213,11 @@
}
///
- /// Gets whether the input parameters are synchronized with the set .
+ /// Applies the properties of the to the
+ /// parameters of the instance of .
///
- /// Always returns false in case no dike profile is present.
- public bool DikeProfileParametersSynchronized
- {
- get
- {
- if (dikeProfile == null)
- {
- return false;
- }
-
- BreakWater defaultBreakwater = dikeProfile.HasBreakWater
- ? new BreakWater(dikeProfile.BreakWater.Type, dikeProfile.BreakWater.Height)
- : GetDefaultBreakWater();
-
- return Equals(UseBreakWater, dikeProfile.HasBreakWater)
- && Equals(BreakWater, defaultBreakwater)
- && Equals(Orientation, dikeProfile.Orientation)
- && Equals(DikeHeight, dikeProfile.DikeHeight)
- && UseForeshore == dikeProfile.ForeshoreGeometry.Count() > 1;
- }
- }
-
- ///
- /// Synchronizes the input parameters with the parameters of the dike profile.
- ///
/// When no dike profile is present, the input parameters are set to default values.
- public void SynchronizeDikeProfileParameters()
+ public void SynchronizeDikeProfileInput()
{
if (dikeProfile != null)
{
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs
===================================================================
diff -u -r842e446f88e513e8be98fa0cf6c111f74d19de6c -r6c7fbd4def41c722f172d3e11329a9635d2f7ba1
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision 842e446f88e513e8be98fa0cf6c111f74d19de6c)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision 6c7fbd4def41c722f172d3e11329a9635d2f7ba1)
@@ -872,9 +872,9 @@
private static void UpdateDikeProfileDerivedCalculationInput(GrassCoverErosionInwardsCalculation calculation)
{
- if (!calculation.InputParameters.DikeProfileParametersSynchronized)
+ if (!calculation.InputParameters.IsDikeProfileInputSynchronized)
{
- calculation.InputParameters.SynchronizeDikeProfileParameters();
+ calculation.InputParameters.SynchronizeDikeProfileInput();
var affectedObjects = new List
{
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs
===================================================================
diff -u -r0a547cee44cdf883a0018582514d2614c8f571a1 -r6c7fbd4def41c722f172d3e11329a9635d2f7ba1
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs (.../GrassCoverErosionInwardsInputTest.cs) (revision 0a547cee44cdf883a0018582514d2614c8f571a1)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs (.../GrassCoverErosionInwardsInputTest.cs) (revision 6c7fbd4def41c722f172d3e11329a9635d2f7ba1)
@@ -38,6 +38,90 @@
[TestFixture]
public class GrassCoverErosionInwardsInputTest
{
+ private static IEnumerable DifferentDikeProfileProperties
+ {
+ get
+ {
+ yield return new TestCaseData(
+ new DikeProfile(new Point2D(0, 0),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(6.6, 7.7), 0.8)
+ }, new[]
+ {
+ new Point2D(2.2, 3.3),
+ new Point2D(4.4, 5.5)
+ }, new BreakWater(BreakWaterType.Caisson, 5.5),
+ new DikeProfile.ConstructionProperties
+ {
+ Id = "id",
+ Orientation = 1.1,
+ DikeHeight = 4.4
+ }))
+ .SetName("DifferentBreakWaterType");
+ yield return new TestCaseData(
+ new DikeProfile(new Point2D(0, 0),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(6.6, 7.7), 0.8)
+ }, new[]
+ {
+ new Point2D(2.2, 3.3),
+ new Point2D(4.4, 5.5)
+ }, new BreakWater(BreakWaterType.Wall, 4),
+ new DikeProfile.ConstructionProperties
+ {
+ Id = "id",
+ Orientation = 1.1,
+ DikeHeight = 4.4
+ }))
+ .SetName("DifferentBreakWaterHeight");
+ yield return new TestCaseData(
+ new DikeProfile(new Point2D(0, 0),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(6.6, 7.7), 0.8)
+ }, new[]
+ {
+ new Point2D(2.2, 3.3),
+ new Point2D(4.4, 5.5)
+ }, new BreakWater(BreakWaterType.Wall, 5.5),
+ new DikeProfile.ConstructionProperties
+ {
+ Id = "id",
+ Orientation = 1.1,
+ DikeHeight = 2
+ }))
+ .SetName("DifferentDikeHeight");
+ yield return new TestCaseData(
+ new DikeProfile(new Point2D(0, 0),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(6.6, 7.7), 0.8)
+ }, new Point2D[0], new BreakWater(BreakWaterType.Wall, 5.5),
+ new DikeProfile.ConstructionProperties
+ {
+ Id = "id",
+ Orientation = 1.1,
+ DikeHeight = 4.4
+ }))
+ .SetName("DifferentUseForeshore");
+ yield return new TestCaseData(
+ new DikeProfile(new Point2D(0, 0),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(6.6, 7.7), 0.8)
+ }, new Point2D[0], null,
+ new DikeProfile.ConstructionProperties
+ {
+ Id = "id",
+ Orientation = 1.1,
+ DikeHeight = 4.4
+ }))
+ .SetName("DifferentUseBreakWater");
+ }
+ }
+
[Test]
public void Constructor_ExpectedValues()
{
@@ -284,7 +368,7 @@
[Test]
[Combinatorial]
- public void SynchronizeDikeProfileParameters_InputAndDikeProfileOutOfSync_InputSyncedAccordingly(
+ public void SynchronizeDikeProfileInput_InputAndDikeProfileOutOfSync_InputSyncedAccordingly(
[Values(true, false)] bool withBreakWater,
[Values(true, false)] bool withValidForeshore)
{
@@ -335,7 +419,7 @@
input.DikeHeight = (RoundedDouble) 4;
// Call
- input.SynchronizeDikeProfileParameters();
+ input.SynchronizeDikeProfileInput();
// Assert
Assert.AreSame(dikeProfile, input.DikeProfile);
@@ -350,7 +434,7 @@
}
[Test]
- public void SynchronizeDikeProfileParameters_DikeProfileNull_InputSyncedToDefaults()
+ public void SynchronizeDikeProfileInput_DikeProfileNull_InputSyncedToDefaults()
{
// Setup
var input = new GrassCoverErosionInwardsInput();
@@ -363,7 +447,7 @@
input.DikeHeight = (RoundedDouble) 4;
// Call
- input.SynchronizeDikeProfileParameters();
+ input.SynchronizeDikeProfileInput();
// Assert
Assert.AreEqual(2, input.Orientation.NumberOfDecimalPlaces);
@@ -379,20 +463,20 @@
}
[Test]
- public void DikeProfileParametersSynchronized_DikeProfileNull_ReturnFalse()
+ public void IsDikeProfileInputSynchronized_DikeProfileNull_ReturnFalse()
{
// Setup
var input = new GrassCoverErosionInwardsInput();
// Call
- bool synchronized = input.DikeProfileParametersSynchronized;
+ bool synchronized = input.IsDikeProfileInputSynchronized;
// Assert
Assert.IsFalse(synchronized);
}
[Test]
- public void DikeProfileParametersSynchronized_InputParametersAndDikeProfileInSync_ReturnTrue()
+ public void IsDikeProfileInputSynchronized_InputParametersAndDikeProfileInSync_ReturnTrue()
{
// Setup
var input = new GrassCoverErosionInwardsInput
@@ -405,15 +489,15 @@
};
// Call
- bool synchronized = input.DikeProfileParametersSynchronized;
+ bool synchronized = input.IsDikeProfileInputSynchronized;
// Assert
Assert.IsTrue(synchronized);
}
[Test]
[TestCaseSource(nameof(DifferentDikeProfileProperties))]
- public void DikeProfileParametersSynchronized_InputParametersAndDikeProfileNotInSync_ReturnFalse(DikeProfile newDikeProfile)
+ public void IsDikeProfileInputSynchronized_InputParametersAndDikeProfileNotInSync_ReturnFalse(DikeProfile newDikeProfile)
{
// Setup
var breakWater = new BreakWater(BreakWaterType.Wall, 5.5);
@@ -450,7 +534,7 @@
input.UseBreakWater = newDikeProfile.HasBreakWater;
// Call
- input.SynchronizeDikeProfileParameters();
+ input.SynchronizeDikeProfileInput();
// Assert
Assert.AreSame(dikeProfile, input.DikeProfile);
@@ -463,89 +547,5 @@
CollectionAssert.AreEqual(dikeProfile.DikeGeometry, input.DikeGeometry);
Assert.AreEqual(dikeProfile.DikeHeight, input.DikeHeight);
}
-
- private static IEnumerable DifferentDikeProfileProperties
- {
- get
- {
- yield return new TestCaseData(
- new DikeProfile(new Point2D(0, 0),
- new[]
- {
- new RoughnessPoint(new Point2D(6.6, 7.7), 0.8)
- }, new[]
- {
- new Point2D(2.2, 3.3),
- new Point2D(4.4, 5.5)
- }, new BreakWater(BreakWaterType.Caisson, 5.5),
- new DikeProfile.ConstructionProperties
- {
- Id = "id",
- Orientation = 1.1,
- DikeHeight = 4.4
- }))
- .SetName("DifferentBreakWaterType");
- yield return new TestCaseData(
- new DikeProfile(new Point2D(0, 0),
- new[]
- {
- new RoughnessPoint(new Point2D(6.6, 7.7), 0.8)
- }, new[]
- {
- new Point2D(2.2, 3.3),
- new Point2D(4.4, 5.5)
- }, new BreakWater(BreakWaterType.Wall, 4),
- new DikeProfile.ConstructionProperties
- {
- Id = "id",
- Orientation = 1.1,
- DikeHeight = 4.4
- }))
- .SetName("DifferentBreakWaterHeight");
- yield return new TestCaseData(
- new DikeProfile(new Point2D(0, 0),
- new[]
- {
- new RoughnessPoint(new Point2D(6.6, 7.7), 0.8)
- }, new[]
- {
- new Point2D(2.2, 3.3),
- new Point2D(4.4, 5.5)
- }, new BreakWater(BreakWaterType.Wall, 5.5),
- new DikeProfile.ConstructionProperties
- {
- Id = "id",
- Orientation = 1.1,
- DikeHeight = 2
- }))
- .SetName("DifferentDikeHeight");
- yield return new TestCaseData(
- new DikeProfile(new Point2D(0, 0),
- new[]
- {
- new RoughnessPoint(new Point2D(6.6, 7.7), 0.8)
- }, new Point2D[0], new BreakWater(BreakWaterType.Wall, 5.5),
- new DikeProfile.ConstructionProperties
- {
- Id = "id",
- Orientation = 1.1,
- DikeHeight = 4.4
- }))
- .SetName("DifferentUseForeshore");
- yield return new TestCaseData(
- new DikeProfile(new Point2D(0, 0),
- new[]
- {
- new RoughnessPoint(new Point2D(6.6, 7.7), 0.8)
- }, new Point2D[0], null,
- new DikeProfile.ConstructionProperties
- {
- Id = "id",
- Orientation = 1.1,
- DikeHeight = 4.4
- }))
- .SetName("DifferentUseBreakWater");
- }
- }
}
}
\ No newline at end of file