Index: Ringtoets/Common/src/Ringtoets.Common.Service/Properties/Resources.Designer.cs
===================================================================
diff -u -r3a89e41054c6cfe6babdc150e8282cbe4a6dc672 -rf09f2ae0881378aedf0b5b576df6ecc3ff44ceee
--- Ringtoets/Common/src/Ringtoets.Common.Service/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 3a89e41054c6cfe6babdc150e8282cbe4a6dc672)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f09f2ae0881378aedf0b5b576df6ecc3ff44ceee)
@@ -175,6 +175,15 @@
}
///
+ /// Looks up a localized string similar to Er is geen geldige damhoogte ingevoerd..
+ ///
+ public static string ValidationService_ValidateInput_invalid_BreakWaterHeight_value {
+ get {
+ return ResourceManager.GetString("Validation_Invalid_BreakWaterHeight_value", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Validatie van '{0}' beëindigd om: {1}.
///
public static string Validation_Subject_0_ended_Time_1_ {
Index: Ringtoets/Common/src/Ringtoets.Common.Service/Properties/Resources.resx
===================================================================
diff -u -r915001caffacbbee15c0e3bf449072245bc5f509 -rf09f2ae0881378aedf0b5b576df6ecc3ff44ceee
--- Ringtoets/Common/src/Ringtoets.Common.Service/Properties/Resources.resx (.../Resources.resx) (revision 915001caffacbbee15c0e3bf449072245bc5f509)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/Properties/Resources.resx (.../Resources.resx) (revision f09f2ae0881378aedf0b5b576df6ecc3ff44ceee)
@@ -165,4 +165,7 @@
Golfhoogte voor locatie {0}
+
+ Er is geen geldige damhoogte ingevoerd.
+
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationService.cs
===================================================================
diff -u -r5cdaf6a62202805aa0abe5636e372a66b1bec723 -rf09f2ae0881378aedf0b5b576df6ecc3ff44ceee
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationService.cs (.../GrassCoverErosionInwardsCalculationService.cs) (revision 5cdaf6a62202805aa0abe5636e372a66b1bec723)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsCalculationService.cs (.../GrassCoverErosionInwardsCalculationService.cs) (revision f09f2ae0881378aedf0b5b576df6ecc3ff44ceee)
@@ -248,6 +248,14 @@
validationResult.Add(validationProblem);
}
+ if (inputParameters.UseBreakWater)
+ {
+ if (double.IsNaN(inputParameters.BreakWater.Height) || double.IsInfinity(inputParameters.BreakWater.Height))
+ {
+ validationResult.Add(RingtoetsCommonServiceResources.ValidationService_ValidateInput_invalid_BreakWaterHeight_value);
+ }
+ }
+
return validationResult.ToArray();
}
}
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationServiceIntegrationTest.cs
===================================================================
diff -u -r30b8231f92b90ea4b05e98e3d0285368f6dfe2e4 -rf09f2ae0881378aedf0b5b576df6ecc3ff44ceee
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationServiceIntegrationTest.cs (.../GrassCoverErosionInwardsCalculationServiceIntegrationTest.cs) (revision 30b8231f92b90ea4b05e98e3d0285368f6dfe2e4)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationServiceIntegrationTest.cs (.../GrassCoverErosionInwardsCalculationServiceIntegrationTest.cs) (revision f09f2ae0881378aedf0b5b576df6ecc3ff44ceee)
@@ -152,6 +152,128 @@
}
[Test]
+ [TestCase(double.NaN)]
+ [TestCase(double.PositiveInfinity)]
+ public void Validate_ValidInputAndUsesInvalidBreakWaterHeight_ReturnsFalse(double breakWaterHeight)
+ {
+ // Setup
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+ ImportHydraulicBoundaryDatabase(assessmentSection);
+
+ const string name = "";
+
+ GrassCoverErosionInwardsCalculation calculation = new GrassCoverErosionInwardsCalculation
+ {
+ Name = name,
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2, 2),
+ DikeProfile = new DikeProfile(new Point2D(0, 0),
+ new RoughnessPoint[0],
+ new Point2D[0],
+ new BreakWater(BreakWaterType.Dam, breakWaterHeight),
+ new DikeProfile.ConstructionProperties()),
+ UseBreakWater = true,
+ }
+ };
+
+ // Call
+ bool isValid = false;
+ Action call = () => isValid = GrassCoverErosionInwardsCalculationService.Validate(calculation, assessmentSection);
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ var msgs = messages.ToArray();
+ Assert.AreEqual(3, msgs.Length);
+ StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", name), msgs[0]);
+ Assert.AreEqual("Validatie mislukt: Er is geen geldige damhoogte ingevoerd.", msgs[1]);
+ StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", name), msgs[2]);
+ });
+ Assert.IsFalse(isValid);
+ }
+
+ [Test]
+ [TestCase(double.NaN)]
+ [TestCase(double.PositiveInfinity)]
+ public void Validate_ValidInputAndDoesNotUseBreakWaterWithInvalidHeight_ReturnsTrue(double breakWaterHeight)
+ {
+ // Setup
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+ ImportHydraulicBoundaryDatabase(assessmentSection);
+
+ const string name = "";
+
+ GrassCoverErosionInwardsCalculation calculation = new GrassCoverErosionInwardsCalculation
+ {
+ Name = name,
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2, 2),
+ DikeProfile = new DikeProfile(new Point2D(0, 0),
+ new RoughnessPoint[0],
+ new Point2D[0],
+ new BreakWater(BreakWaterType.Dam, breakWaterHeight),
+ new DikeProfile.ConstructionProperties()),
+ UseBreakWater = false,
+ }
+ };
+
+ // Call
+ bool isValid = false;
+ Action call = () => isValid = GrassCoverErosionInwardsCalculationService.Validate(calculation, assessmentSection);
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ var msgs = messages.ToArray();
+ Assert.AreEqual(2, msgs.Length);
+ StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", name), msgs[0]);
+ StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", name), msgs[1]);
+ });
+ Assert.IsTrue(isValid);
+ }
+
+ [Test]
+ public void Validate_ValidInputWithValidBreakWaterHeight_ReturnsTrue()
+ {
+ // Setup
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+ ImportHydraulicBoundaryDatabase(assessmentSection);
+
+ const string name = "";
+
+ GrassCoverErosionInwardsCalculation calculation = new GrassCoverErosionInwardsCalculation
+ {
+ Name = name,
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2, 2),
+ DikeProfile = new DikeProfile(new Point2D(0, 0),
+ new RoughnessPoint[0],
+ new Point2D[0],
+ new BreakWater(BreakWaterType.Dam, 10.0),
+ new DikeProfile.ConstructionProperties()),
+ UseBreakWater = true,
+ }
+ };
+
+ // Call
+ bool isValid = false;
+ Action call = () => isValid = GrassCoverErosionInwardsCalculationService.Validate(calculation, assessmentSection);
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ var msgs = messages.ToArray();
+ Assert.AreEqual(2, msgs.Length);
+ StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", name), msgs[0]);
+ StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", name), msgs[1]);
+ });
+ Assert.IsTrue(isValid);
+ }
+
+ [Test]
public void Validate_ValidInput_ReturnsTrue()
{
// Setup
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Service/Properties/Resources.Designer.cs
===================================================================
diff -u -r8a04b4a13dcd6b3a78888b0305e239b2978c5dae -rf09f2ae0881378aedf0b5b576df6ecc3ff44ceee
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Service/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8a04b4a13dcd6b3a78888b0305e239b2978c5dae)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Service/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f09f2ae0881378aedf0b5b576df6ecc3ff44ceee)
@@ -82,15 +82,6 @@
}
///
- /// Looks up a localized string similar to Geen geldige damhoogte ingevoerd..
- ///
- internal static string WaveConditionsCalculationService_ValidateInput_Invalid_BreakWaterHeight_value {
- get {
- return ResourceManager.GetString("WaveConditionsCalculationService_ValidateInput_Invalid_BreakWaterHeight_value", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized string similar to Kan geen waterstanden afleiden op basis van de invoer. Controleer de opgegeven boven- en ondergrenzen..
///
internal static string WaveConditionsCalculationService_ValidateInput_No_derived_WaterLevels {
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Service/Properties/Resources.resx
===================================================================
diff -u -r8a04b4a13dcd6b3a78888b0305e239b2978c5dae -rf09f2ae0881378aedf0b5b576df6ecc3ff44ceee
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Service/Properties/Resources.resx (.../Resources.resx) (revision 8a04b4a13dcd6b3a78888b0305e239b2978c5dae)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Service/Properties/Resources.resx (.../Resources.resx) (revision f09f2ae0881378aedf0b5b576df6ecc3ff44ceee)
@@ -129,7 +129,4 @@
Kan geen waterstanden afleiden op basis van de invoer. Controleer de opgegeven boven- en ondergrenzen.
-
- Er is geen geldige damhoogte ingevoerd.
-
\ No newline at end of file
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationService.cs
===================================================================
diff -u -r8a04b4a13dcd6b3a78888b0305e239b2978c5dae -rf09f2ae0881378aedf0b5b576df6ecc3ff44ceee
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationService.cs (.../WaveConditionsCalculationService.cs) (revision 8a04b4a13dcd6b3a78888b0305e239b2978c5dae)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationService.cs (.../WaveConditionsCalculationService.cs) (revision f09f2ae0881378aedf0b5b576df6ecc3ff44ceee)
@@ -196,7 +196,7 @@
{
if (double.IsInfinity(input.BreakWater.Height) || double.IsNaN(input.BreakWater.Height))
{
- return Resources.WaveConditionsCalculationService_ValidateInput_Invalid_BreakWaterHeight_value;
+ return RingtoetsCommonServiceResources.ValidationService_ValidateInput_invalid_BreakWaterHeight_value;
}
}