Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Importers/WaveConditionsCalculationConfigurationImporter.cs =================================================================== diff -u -r69c1988e3c492c44148e112151efb3c04a853fcc -r911577ed4bdd54ed724e39b8c221d5aa21510295 --- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Importers/WaveConditionsCalculationConfigurationImporter.cs (.../WaveConditionsCalculationConfigurationImporter.cs) (revision 69c1988e3c492c44148e112151efb3c04a853fcc) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Importers/WaveConditionsCalculationConfigurationImporter.cs (.../WaveConditionsCalculationConfigurationImporter.cs) (revision 911577ed4bdd54ed724e39b8c221d5aa21510295) @@ -191,7 +191,7 @@ try { - calculation.InputParameters.UpperBoundaryWaterLevels = (RoundedDouble)upperBoundaryWaterLevels; + calculation.InputParameters.UpperBoundaryWaterLevels = (RoundedDouble) upperBoundaryWaterLevels; } catch (ArgumentOutOfRangeException e) { @@ -209,7 +209,7 @@ try { - calculation.InputParameters.LowerBoundaryWaterLevels = (RoundedDouble)lowerBoundaryWaterLevels; + calculation.InputParameters.LowerBoundaryWaterLevels = (RoundedDouble) lowerBoundaryWaterLevels; } catch (ArgumentOutOfRangeException e) { @@ -348,7 +348,7 @@ } else if (!calculation.InputParameters.ForeshoreGeometry.Any()) { - if (readCalculation.UseForeshore.HasValue) + if (readCalculation.UseForeshore.HasValue && readCalculation.UseForeshore.Value) { LogReadCalculationConversionError(string.Format( Resources.WaveConditionsCalculationConfigurationImporter_ValidateWaveReduction_ForeshoreProfile_0_has_no_geometry_and_cannot_be_used, Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Importers/WaveConditionsCalculationConfigurationImporterTest.cs =================================================================== diff -u -r3fa1f22b25a81f42d033e29e29d57e362eff8662 -r911577ed4bdd54ed724e39b8c221d5aa21510295 --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Importers/WaveConditionsCalculationConfigurationImporterTest.cs (.../WaveConditionsCalculationConfigurationImporterTest.cs) (revision 3fa1f22b25a81f42d033e29e29d57e362eff8662) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Importers/WaveConditionsCalculationConfigurationImporterTest.cs (.../WaveConditionsCalculationConfigurationImporterTest.cs) (revision 911577ed4bdd54ed724e39b8c221d5aa21510295) @@ -114,7 +114,7 @@ // Assert string expectedMessage = $"{expectedErrorMessage} Berekening 'Berekening 1' is overgeslagen."; - TestHelper.AssertLogMessageIsGenerated(call, expectedMessage, 1); + TestHelper.AssertLogMessageWithLevelIsGenerated(call, new Tuple(expectedMessage, LogLevelConstant.Error), 1); Assert.IsTrue(successful); CollectionAssert.IsEmpty(calculationGroup.Children); } @@ -138,7 +138,7 @@ // Assert const string expectedMessage = "De locatie met hydraulische randvoorwaarden 'HRlocatie' bestaat niet. Berekening 'Calculation' is overgeslagen."; - TestHelper.AssertLogMessageIsGenerated(call, expectedMessage, 1); + TestHelper.AssertLogMessageWithLevelIsGenerated(call, new Tuple(expectedMessage, LogLevelConstant.Error), 1); Assert.IsTrue(successful); CollectionAssert.IsEmpty(calculationGroup.Children); } @@ -162,7 +162,7 @@ // Assert const string expectedMessage = "Het voorlandprofiel 'Voorlandprofiel' bestaat niet. Berekening 'Berekening 1' is overgeslagen."; - TestHelper.AssertLogMessageIsGenerated(call, expectedMessage, 1); + TestHelper.AssertLogMessageWithLevelIsGenerated(call, new Tuple(expectedMessage, LogLevelConstant.Error), 1); Assert.IsTrue(successful); CollectionAssert.IsEmpty(calculationGroup.Children); } @@ -186,16 +186,16 @@ // Assert const string expectedMessage = "Er is geen voorlandprofiel opgegeven om golfreductie parameters aan toe te voegen. Berekening 'Berekening 1' is overgeslagen."; - TestHelper.AssertLogMessageIsGenerated(call, expectedMessage, 1); + TestHelper.AssertLogMessageWithLevelIsGenerated(call, new Tuple(expectedMessage, LogLevelConstant.Error), 1); Assert.IsTrue(successful); CollectionAssert.IsEmpty(calculationGroup.Children); } [Test] - public void Import_UseForeshoreButProfileWithoutGeometry_LogMessageAndContinueImport() + public void Import_UseForeshoreTrueButProfileWithoutForeshoreGeometry_LogMessageAndContinueImport() { // Setup - string filePath = Path.Combine(path, "validConfigurationCalculationContainingUseForeshoreForeshoreProfileWithoutGeometry.xml"); + string filePath = Path.Combine(path, "validConfigurationCalculationUseForeshoreTrueForeshoreProfileWithoutGeometry.xml"); var calculationGroup = new CalculationGroup(); var foreshoreProfile = new TestForeshoreProfile("Voorlandprofiel"); @@ -214,12 +214,50 @@ // Assert const string expectedMessage = "Het opgegeven voorlandprofiel 'Voorlandprofiel' heeft geen geometrie en kan daarom niet gebruikt worden. Berekening 'Berekening 1' is overgeslagen."; - TestHelper.AssertLogMessageIsGenerated(call, expectedMessage, 1); + TestHelper.AssertLogMessageWithLevelIsGenerated(call, new Tuple(expectedMessage, LogLevelConstant.Error), 1); Assert.IsTrue(successful); CollectionAssert.IsEmpty(calculationGroup.Children); } [Test] + public void Import_UseForeshoreFalseButProfileWithoutForeshoreGeometry_DataAddedToModel() + { + // Setup + string filePath = Path.Combine(path, "validConfigurationCalculationUseForeshoreFalseForeshoreProfileWithoutGeometry.xml"); + + var calculationGroup = new CalculationGroup(); + var foreshoreProfile = new TestForeshoreProfile("Voorlandprofiel"); + var importer = new WaveConditionsCalculationConfigurationImporter( + filePath, + calculationGroup, + Enumerable.Empty(), + new[] + { + foreshoreProfile + }); + + // Call + bool successful = importer.Import(); + + // Assert + Assert.IsTrue(successful); + + var expectedCalculation = new SimpleWaveConditionsCalculation + { + Name = "Berekening 1", + InputParameters = + { + UseForeshore = false, + Orientation = (RoundedDouble) 0, + ForeshoreProfile = foreshoreProfile + } + }; + + Assert.AreEqual(1, calculationGroup.Children.Count); + AssertWaveConditionsCalculation(expectedCalculation, (IWaveConditionsCalculation)calculationGroup.Children[0]); + } + + [Test] public void Import_ValidConfigurationWithValidData_DataAddedToModel() { // Setup Fisheye: Tag 911577ed4bdd54ed724e39b8c221d5aa21510295 refers to a dead (removed) revision in file `Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationImporter/validConfigurationCalculationContainingUseForeshoreForeshoreProfileWithoutGeometry.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationImporter/validConfigurationCalculationUseForeshoreFalseForeshoreProfileWithoutGeometry.xml =================================================================== diff -u --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationImporter/validConfigurationCalculationUseForeshoreFalseForeshoreProfileWithoutGeometry.xml (revision 0) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationImporter/validConfigurationCalculationUseForeshoreFalseForeshoreProfileWithoutGeometry.xml (revision 911577ed4bdd54ed724e39b8c221d5aa21510295) @@ -0,0 +1,9 @@ + + + + Voorlandprofiel + + false + + + Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationImporter/validConfigurationCalculationUseForeshoreTrueForeshoreProfileWithoutGeometry.xml =================================================================== diff -u --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationImporter/validConfigurationCalculationUseForeshoreTrueForeshoreProfileWithoutGeometry.xml (revision 0) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationImporter/validConfigurationCalculationUseForeshoreTrueForeshoreProfileWithoutGeometry.xml (revision 911577ed4bdd54ed724e39b8c221d5aa21510295) @@ -0,0 +1,9 @@ + + + + Voorlandprofiel + + true + + +