Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Importers/WaveConditionsCalculationConfigurationImporterTest.cs =================================================================== diff -u -r4272fbc8be7c5932b0caeaf32ab5c11a4fb21bf7 -r7f1ba7a4362a13d9b0e8dca02691bb3eae74bd79 --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Importers/WaveConditionsCalculationConfigurationImporterTest.cs (.../WaveConditionsCalculationConfigurationImporterTest.cs) (revision 4272fbc8be7c5932b0caeaf32ab5c11a4fb21bf7) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Importers/WaveConditionsCalculationConfigurationImporterTest.cs (.../WaveConditionsCalculationConfigurationImporterTest.cs) (revision 7f1ba7a4362a13d9b0e8dca02691bb3eae74bd79) @@ -28,7 +28,9 @@ using NUnit.Framework; using Ringtoets.Common.Data; using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.IO.FileImporters; using Ringtoets.Revetment.Data; using Ringtoets.Revetment.IO.Importers; @@ -48,7 +50,8 @@ var importer = new WaveConditionsCalculationConfigurationImporter( "", new CalculationGroup(), - Enumerable.Empty()); + Enumerable.Empty(), + Enumerable.Empty()); // Assert Assert.IsInstanceOf>(importer); @@ -61,14 +64,30 @@ TestDelegate test = () => new WaveConditionsCalculationConfigurationImporter( "", new CalculationGroup(), - null); + null, + Enumerable.Empty()); // Assert var exception = Assert.Throws(test); Assert.AreEqual("hydraulicBoundaryLocations", exception.ParamName); } [Test] + public void Constructor_ForeshoreProfilesNull_ThrowArgumentNullException() + { + // Call + TestDelegate test = () => new WaveConditionsCalculationConfigurationImporter( + "", + new CalculationGroup(), + Enumerable.Empty(), + null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("foreshoreProfiles", exception.ParamName); + } + + [Test] [SetCulture("nl-NL")] [TestCase("validConfigurationInvalidRevetmentBoundaries.xml", "Een waarde van '2,2' als ondergrens bekledingen is ongeldig. De bovengrens van de bekleding moet boven de ondergrens liggen.")] @@ -85,7 +104,8 @@ var importer = new WaveConditionsCalculationConfigurationImporter( filePath, calculationGroup, - Enumerable.Empty()); + Enumerable.Empty(), + Enumerable.Empty()); // Call var successful = false; @@ -108,7 +128,8 @@ var importer = new WaveConditionsCalculationConfigurationImporter( filePath, calculationGroup, - Enumerable.Empty()); + Enumerable.Empty(), + Enumerable.Empty()); // Call var successful = false; @@ -122,19 +143,48 @@ } [Test] + public void Import_ForeshoreProfileUnknown_LogMessageAndContinueImport() + { + // Setup + string filePath = Path.Combine(path, "validConfigurationCalculationContainingUnknownForeshoreProfile.xml"); + + var calculationGroup = new CalculationGroup(); + var importer = new WaveConditionsCalculationConfigurationImporter( + filePath, + calculationGroup, + Enumerable.Empty(), + Enumerable.Empty()); + + // Call + var successful = false; + Action call = () => successful = importer.Import(); + + // Assert + const string expectedMessage = "Het voorlandprofiel 'Voorlandprofiel' bestaat niet. Berekening 'Berekening 1' is overgeslagen."; + TestHelper.AssertLogMessageIsGenerated(call, expectedMessage, 1); + Assert.IsTrue(successful); + CollectionAssert.IsEmpty(calculationGroup.Children); + } + + [Test] public void Import_ValidConfigurationWithValidData_DataAddedToModel() { // Setup string filePath = Path.Combine(path, "validConfigurationFullCalculation.xml"); var calculationGroup = new CalculationGroup(); var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "HRlocatie", 10, 20); + var foreshoreProfile = new TestForeshoreProfile("Voorlandprofiel"); var importer = new WaveConditionsCalculationConfigurationImporter( filePath, calculationGroup, new[] { hydraulicBoundaryLocation + }, + new[] + { + foreshoreProfile }); // Call @@ -154,6 +204,7 @@ UpperBoundaryWaterLevels = (RoundedDouble) 9, LowerBoundaryWaterLevels = (RoundedDouble) 4, StepSize = WaveConditionsInputStepSize.Half, + ForeshoreProfile = foreshoreProfile, Orientation = (RoundedDouble) 5.5 } }; @@ -172,6 +223,7 @@ Assert.AreEqual(expectedCalculation.InputParameters.LowerBoundaryWaterLevels, actualCalculation.InputParameters.LowerBoundaryWaterLevels); Assert.AreEqual(expectedCalculation.InputParameters.StepSize, actualCalculation.InputParameters.StepSize); Assert.AreEqual(expectedCalculation.InputParameters.Orientation, actualCalculation.InputParameters.Orientation); + Assert.AreEqual(expectedCalculation.InputParameters.ForeshoreProfile, actualCalculation.InputParameters.ForeshoreProfile); } private class SimpleWaveConditionsCalculation : Observable, IWaveConditionsCalculation