Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationImporter.cs
===================================================================
diff -u -r78822681793277150da4eac3ac214a9aa59a47dd -rd21dfcc1bb4e27911dde3c32ae83291132a973c2
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationImporter.cs (.../StabilityPointStructuresCalculationConfigurationImporter.cs) (revision 78822681793277150da4eac3ac214a9aa59a47dd)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Configurations/StabilityPointStructuresCalculationConfigurationImporter.cs (.../StabilityPointStructuresCalculationConfigurationImporter.cs) (revision d21dfcc1bb4e27911dde3c32ae83291132a973c2)
@@ -115,6 +115,7 @@
&& readCalculation.WaveReduction.ValidateWaveReduction(calculation.InputParameters.ForeshoreProfile, calculation.Name, Log))
{
ReadFactorStormDurationOpenStructure(readCalculation, calculation);
+ ReadVolumicWeightWater(readCalculation, calculation);
ReadWaveReductionParameters(readCalculation.WaveReduction, calculation.InputParameters);
return calculation;
}
@@ -128,7 +129,8 @@
/// The calculation to configure.
/// false when the evaluation level is invalid or when there is an
/// evaluation level but no structure defined, true otherwise.
- private bool TryReadEvaluationLevel(StabilityPointStructuresCalculationConfiguration readCalculation, StructuresCalculation calculation)
+ private bool TryReadEvaluationLevel(StabilityPointStructuresCalculationConfiguration readCalculation,
+ StructuresCalculation calculation)
{
if (readCalculation.EvaluationLevel.HasValue)
{
@@ -396,7 +398,8 @@
/// The calculation to configure.
/// false when the orientation is invalid or when there is a failure probability
/// structure with erosion but no structure defined, true otherwise.
- private bool TryReadFailureProbabilityStructureWithErosion(StructuresCalculationConfiguration readCalculation, StructuresCalculation calculation)
+ private bool TryReadFailureProbabilityStructureWithErosion(StructuresCalculationConfiguration readCalculation,
+ StructuresCalculation calculation)
{
if (readCalculation.FailureProbabilityStructureWithErosion.HasValue)
{
@@ -471,13 +474,27 @@
///
/// The calculation read from the imported file.
/// The calculation to configure.
- private void ReadFactorStormDurationOpenStructure(StabilityPointStructuresCalculationConfiguration readCalculation, StructuresCalculation calculation)
+ private void ReadFactorStormDurationOpenStructure(StabilityPointStructuresCalculationConfiguration readCalculation,
+ StructuresCalculation calculation)
{
if (readCalculation.FactorStormDurationOpenStructure.HasValue)
{
calculation.InputParameters.FactorStormDurationOpenStructure = (RoundedDouble) readCalculation.FactorStormDurationOpenStructure.Value;
}
}
+ ///
+ /// Reads the volumic weight water.
+ ///
+ /// The calculation read from the imported file.
+ /// The calculation to configure.
+ private void ReadVolumicWeightWater(StabilityPointStructuresCalculationConfiguration readCalculation,
+ StructuresCalculation calculation)
+ {
+ if (readCalculation.VolumicWeightWater.HasValue)
+ {
+ calculation.InputParameters.VolumicWeightWater = (RoundedDouble) readCalculation.VolumicWeightWater.Value;
+ }
+ }
///
/// Reads the inflow model type.
@@ -486,7 +503,8 @@
/// The calculation to configure.
/// false when the inflow model type is invalid or when there is a
/// inflow model type but no structure defined, true otherwise.
- private bool TryReadInflowModelType(StabilityPointStructuresCalculationConfiguration readCalculation, StructuresCalculation calculation)
+ private bool TryReadInflowModelType(StabilityPointStructuresCalculationConfiguration readCalculation,
+ StructuresCalculation calculation)
{
if (readCalculation.InflowModelType.HasValue)
{
@@ -514,7 +532,8 @@
/// The calculation to configure.
/// false when the load schematization type is invalid or when there is a
/// load schematization type but no structure defined, true otherwise.
- private bool TryReadLoadSchematizationType(StabilityPointStructuresCalculationConfiguration readCalculation, StructuresCalculation calculation)
+ private bool TryReadLoadSchematizationType(StabilityPointStructuresCalculationConfiguration readCalculation,
+ StructuresCalculation calculation)
{
if (readCalculation.LoadSchematizationType.HasValue)
{
@@ -542,7 +561,8 @@
/// The calculation to configure.
/// false when the leveling count is invalid or when there is a
/// leveling count but no structure defined, true otherwise.
- private bool TryReadLevellingCount(StabilityPointStructuresCalculationConfiguration readCalculation, StructuresCalculation calculation)
+ private bool TryReadLevellingCount(StabilityPointStructuresCalculationConfiguration readCalculation,
+ StructuresCalculation calculation)
{
if (readCalculation.LevellingCount.HasValue)
{
@@ -568,7 +588,8 @@
/// The calculation to configure.
/// false when the vertical distance is invalid or when there is a
/// vertical distance but no structure defined, true otherwise.
- private bool TryReadVerticalDistance(StabilityPointStructuresCalculationConfiguration readCalculation, StructuresCalculation calculation)
+ private bool TryReadVerticalDistance(StabilityPointStructuresCalculationConfiguration readCalculation,
+ StructuresCalculation calculation)
{
if (readCalculation.VerticalDistance.HasValue)
{
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/Configurations/StabilityPointStructuresCalculationConfigurationImporterTest.cs
===================================================================
diff -u -r78822681793277150da4eac3ac214a9aa59a47dd -rd21dfcc1bb4e27911dde3c32ae83291132a973c2
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/Configurations/StabilityPointStructuresCalculationConfigurationImporterTest.cs (.../StabilityPointStructuresCalculationConfigurationImporterTest.cs) (revision 78822681793277150da4eac3ac214a9aa59a47dd)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/Configurations/StabilityPointStructuresCalculationConfigurationImporterTest.cs (.../StabilityPointStructuresCalculationConfigurationImporterTest.cs) (revision d21dfcc1bb4e27911dde3c32ae83291132a973c2)
@@ -182,17 +182,18 @@
var structure = new TestStabilityPointStructure("kunstwerk1");
var foreshoreProfile = new TestForeshoreProfile("profiel 1");
- var importer = new StabilityPointStructuresCalculationConfigurationImporter(filePath,
- calculationGroup,
- Enumerable.Empty(),
- new ForeshoreProfile[]
- {
- foreshoreProfile
- },
- new StabilityPointStructure[]
- {
- structure
- });
+ var importer = new StabilityPointStructuresCalculationConfigurationImporter(
+ filePath,
+ calculationGroup,
+ Enumerable.Empty(),
+ new ForeshoreProfile[]
+ {
+ foreshoreProfile
+ },
+ new StabilityPointStructure[]
+ {
+ structure
+ });
var successful = false;
// Call
@@ -206,6 +207,37 @@
}
[Test]
+ public void Import_UseForeshoreButForeshoreProfileWithoutGeometry_LogMessageAndContinueImport()
+ {
+ // Setup
+ string filePath = Path.Combine(importerPath, "validConfigurationCalculationUseForeshoreWithoutGeometry.xml");
+
+ var calculationGroup = new CalculationGroup();
+ var foreshoreProfile = new TestForeshoreProfile("Voorlandprofiel");
+ var importer = new StabilityPointStructuresCalculationConfigurationImporter(
+ filePath,
+ calculationGroup,
+ Enumerable.Empty(),
+ new[]
+ {
+ foreshoreProfile
+ },
+ Enumerable.Empty());
+
+ var successful = false;
+
+ // Call
+ Action call = () => successful = importer.Import();
+
+ // Assert
+ const string expectedMessage = "Het opgegeven voorlandprofiel 'Voorlandprofiel' heeft geen voorlandgeometrie en kan daarom niet gebruikt worden. " +
+ "Berekening 'Berekening 1' is overgeslagen.";
+ TestHelper.AssertLogMessageWithLevelIsGenerated(call, Tuple.Create(expectedMessage, LogLevelConstant.Error), 1);
+ Assert.IsTrue(successful);
+ CollectionAssert.IsEmpty(calculationGroup.Children);
+ }
+
+ [Test]
[TestCase("validConfigurationEmptyCalculation.xml")]
[TestCase("validConfigurationEmptyStochasts.xml")]
[TestCase("validConfigurationEmptyStochastElements.xml")]
@@ -259,15 +291,18 @@
calculationGroup,
new[]
{
- hydraulicBoundaryLocation
+ hydraulicBoundaryLocation,
+ new TestHydraulicBoundaryLocation("Other location")
},
new[]
{
- foreshoreProfile
+ foreshoreProfile,
+ new TestForeshoreProfile("Other profile")
},
new[]
{
- structure
+ structure,
+ new TestStabilityPointStructure("other structure")
});
// Call
@@ -283,7 +318,6 @@
HydraulicBoundaryLocation = hydraulicBoundaryLocation,
Structure = structure,
ForeshoreProfile = foreshoreProfile,
-
AllowedLevelIncreaseStorage =
{
Mean = (RoundedDouble) 0.2,
@@ -402,6 +436,7 @@
StandardDeviation = (RoundedDouble) 0.1
},
VerticalDistance = (RoundedDouble) 2,
+ VolumicWeightWater = (RoundedDouble) 9.91,
WidthFlowApertures =
{
Mean = (RoundedDouble) 15.2,
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/test-data/StabilityPointStructuresCalculationConfigurationImporter/validConfigurationCalculationUseForeshoreWithoutGeometry.xml
===================================================================
diff -u
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/test-data/StabilityPointStructuresCalculationConfigurationImporter/validConfigurationCalculationUseForeshoreWithoutGeometry.xml (revision 0)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/test-data/StabilityPointStructuresCalculationConfigurationImporter/validConfigurationCalculationUseForeshoreWithoutGeometry.xml (revision d21dfcc1bb4e27911dde3c32ae83291132a973c2)
@@ -0,0 +1,9 @@
+
+
+
+ Voorlandprofiel
+
+ true
+
+
+
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/test-data/StabilityPointStructuresCalculationConfigurationImporter/validFullConfiguration.xml
===================================================================
diff -u -r78822681793277150da4eac3ac214a9aa59a47dd -rd21dfcc1bb4e27911dde3c32ae83291132a973c2
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/test-data/StabilityPointStructuresCalculationConfigurationImporter/validFullConfiguration.xml (.../validFullConfiguration.xml) (revision 78822681793277150da4eac3ac214a9aa59a47dd)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/test-data/StabilityPointStructuresCalculationConfigurationImporter/validFullConfiguration.xml (.../validFullConfiguration.xml) (revision d21dfcc1bb4e27911dde3c32ae83291132a973c2)
@@ -2,7 +2,7 @@
Locatie1
- 9.81
+ 9.91
0.002
kunstwerk1
7