Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/WaveConditions/ExportableWaveConditions.cs =================================================================== diff -u -r5ca67bdbaab0f6a9fb7682c06140b93bb0f5b5bb -r70498755638c516e4a216d70b6d50efa898047fc --- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/WaveConditions/ExportableWaveConditions.cs (.../ExportableWaveConditions.cs) (revision 5ca67bdbaab0f6a9fb7682c06140b93bb0f5b5bb) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/WaveConditions/ExportableWaveConditions.cs (.../ExportableWaveConditions.cs) (revision 70498755638c516e4a216d70b6d50efa898047fc) @@ -37,11 +37,12 @@ /// The input parameters of the parent calculation. /// The output parameters of the parent calculation. /// The type of dike cover. - /// Thrown when , , or - /// is null. + /// The name of the category boundary. + /// Thrown when parameter is null. /// Thrown when /// is null for . - public ExportableWaveConditions(string name, WaveConditionsInput waveConditionsInput, WaveConditionsOutput waveConditionsOutput, CoverType coverType) + public ExportableWaveConditions(string name, WaveConditionsInput waveConditionsInput, WaveConditionsOutput waveConditionsOutput, CoverType coverType, + string categoryBoundaryName) { if (name == null) { @@ -56,6 +57,16 @@ throw new ArgumentNullException(nameof(waveConditionsOutput)); } + if (coverType == null) + { + throw new ArgumentNullException(nameof(coverType)); + } + + if (categoryBoundaryName == null) + { + throw new ArgumentNullException(nameof(categoryBoundaryName)); + } + if (waveConditionsInput.HydraulicBoundaryLocation == null) { throw new ArgumentException(@"HydraulicBoundaryLocation is null.", nameof(waveConditionsInput)); @@ -72,6 +83,7 @@ UseForeshore = waveConditionsInput.UseForeshore; UseBreakWater = waveConditionsInput.UseBreakWater; CoverType = coverType; + CategoryBoundaryName = categoryBoundaryName; WaterLevel = waveConditionsOutput.WaterLevel; WaveHeight = waveConditionsOutput.WaveHeight; WavePeriod = waveConditionsOutput.WavePeakPeriod; @@ -110,6 +122,11 @@ public CoverType CoverType { get; } /// + /// Gets the name of the category boundary. + /// + public string CategoryBoundaryName { get; } + + /// /// Gets the id of the foreshore. /// public string ForeshoreId { get; } Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/WaveConditions/ExportableWaveConditionsFactory.cs =================================================================== diff -u -r9154fd19f43de57e74c4e916d74c9619e69bf2d1 -r70498755638c516e4a216d70b6d50efa898047fc --- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/WaveConditions/ExportableWaveConditionsFactory.cs (.../ExportableWaveConditionsFactory.cs) (revision 9154fd19f43de57e74c4e916d74c9619e69bf2d1) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/WaveConditions/ExportableWaveConditionsFactory.cs (.../ExportableWaveConditionsFactory.cs) (revision 70498755638c516e4a216d70b6d50efa898047fc) @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Core.Common.Util; using Ringtoets.Revetment.Data; namespace Ringtoets.Revetment.IO.WaveConditions @@ -67,13 +68,15 @@ throw new ArgumentNullException(nameof(blocksOutput)); } - var exportableWaveConditionsCollection = new List(); + string categoryBoundaryName = GetCategoryBoundaryName(waveConditionsInput.CategoryType); + var exportableWaveConditionsCollection = new List(); exportableWaveConditionsCollection.AddRange(CreateExportableWaveConditionsCollection(name, waveConditionsInput, - columnsOutput, CoverType.StoneCoverColumns)); + columnsOutput, CoverType.StoneCoverColumns, + categoryBoundaryName)); exportableWaveConditionsCollection.AddRange(CreateExportableWaveConditionsCollection(name, waveConditionsInput, - blocksOutput, CoverType.StoneCoverBlocks)); - + blocksOutput, CoverType.StoneCoverBlocks, + categoryBoundaryName)); return exportableWaveConditionsCollection; } @@ -95,7 +98,13 @@ string name, FailureMechanismCategoryWaveConditionsInput waveConditionsInput, IEnumerable output) { - return CreateExportableWaveConditionsCollection(name, waveConditionsInput, output, CoverType.Grass); + if (waveConditionsInput == null) + { + throw new ArgumentNullException(nameof(waveConditionsInput)); + } + + return CreateExportableWaveConditionsCollection(name, waveConditionsInput, output, CoverType.Grass, + GetCategoryBoundaryName(waveConditionsInput.CategoryType)); } /// @@ -116,16 +125,28 @@ string name, AssessmentSectionCategoryWaveConditionsInput waveConditionsInput, IEnumerable output) { - return CreateExportableWaveConditionsCollection(name, waveConditionsInput, output, CoverType.Asphalt); + if (waveConditionsInput == null) + { + throw new ArgumentNullException(nameof(waveConditionsInput)); + } + + return CreateExportableWaveConditionsCollection(name, waveConditionsInput, output, CoverType.Asphalt, + GetCategoryBoundaryName(waveConditionsInput.CategoryType)); } + private static string GetCategoryBoundaryName(T enumValue) + { + return new EnumDisplayWrapper(enumValue).DisplayName; + } + /// /// Create a collection of . /// /// The name of the calculation to which the objects belong. /// The used in the calculations. /// The objects resulting from the calculations. /// The type of cover. + /// The name of the category boundary. /// A container of objects. /// Thrown when: /// @@ -137,25 +158,21 @@ /// Thrown when /// is null for . private static IEnumerable CreateExportableWaveConditionsCollection( - string name, WaveConditionsInput waveConditionsInput, - IEnumerable output, CoverType coverType) + string name, WaveConditionsInput waveConditionsInput, IEnumerable output, + CoverType coverType, string categoryBoundaryName) { if (name == null) { throw new ArgumentNullException(nameof(name)); } - if (waveConditionsInput == null) - { - throw new ArgumentNullException(nameof(waveConditionsInput)); - } - if (output == null) { throw new ArgumentNullException(nameof(output)); } - return output.Select(waveConditionsOutput => new ExportableWaveConditions(name, waveConditionsInput, waveConditionsOutput, coverType)).ToArray(); + return output.Select(waveConditionsOutput => new ExportableWaveConditions(name, waveConditionsInput, waveConditionsOutput, + coverType, categoryBoundaryName)).ToArray(); } } } \ No newline at end of file Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/ExportableWaveConditionsFactoryTest.cs =================================================================== diff -u -r9154fd19f43de57e74c4e916d74c9619e69bf2d1 -r70498755638c516e4a216d70b6d50efa898047fc --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/ExportableWaveConditionsFactoryTest.cs (.../ExportableWaveConditionsFactoryTest.cs) (revision 9154fd19f43de57e74c4e916d74c9619e69bf2d1) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/ExportableWaveConditionsFactoryTest.cs (.../ExportableWaveConditionsFactoryTest.cs) (revision 70498755638c516e4a216d70b6d50efa898047fc) @@ -23,6 +23,8 @@ using System.Collections.Generic; using System.Linq; using NUnit.Framework; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Revetment.Data; @@ -119,7 +121,8 @@ { HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "hblName", 1.0, 8.0), ForeshoreProfile = new TestForeshoreProfile(), - UseForeshore = true + UseForeshore = true, + CategoryType = AssessmentSectionCategoryType.SignalingNorm }; // Call @@ -143,6 +146,7 @@ Assert.AreEqual(false, exportableWaveConditions.UseBreakWater); Assert.AreEqual(true, exportableWaveConditions.UseForeshore); Assert.AreEqual(CoverType.StoneCoverColumns, exportableWaveConditions.CoverType); + Assert.AreEqual("A->B", exportableWaveConditions.CategoryBoundaryName); Assert.AreEqual(2, exportableWaveConditions.WaterLevel.NumberOfDecimalPlaces); Assert.AreEqual(2, exportableWaveConditions.WaveHeight.NumberOfDecimalPlaces); Assert.AreEqual(2, exportableWaveConditions.WavePeriod.NumberOfDecimalPlaces); @@ -201,7 +205,8 @@ { HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "hblName", 1.0, 8.0), ForeshoreProfile = new TestForeshoreProfile(), - UseForeshore = true + UseForeshore = true, + CategoryType = FailureMechanismCategoryType.MechanismSpecificFactorizedSignalingNorm }; // Call @@ -221,6 +226,7 @@ Assert.AreEqual(false, exportableWaveConditions.UseBreakWater); Assert.AreEqual(true, exportableWaveConditions.UseForeshore); Assert.AreEqual(CoverType.Grass, exportableWaveConditions.CoverType); + Assert.AreEqual("Iv->IIv", exportableWaveConditions.CategoryBoundaryName); Assert.AreEqual(2, exportableWaveConditions.WaterLevel.NumberOfDecimalPlaces); Assert.AreEqual(2, exportableWaveConditions.WaveHeight.NumberOfDecimalPlaces); Assert.AreEqual(2, exportableWaveConditions.WavePeriod.NumberOfDecimalPlaces); @@ -279,7 +285,8 @@ { HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "hblName", 1.0, 8.0), ForeshoreProfile = new TestForeshoreProfile(), - UseForeshore = true + UseForeshore = true, + CategoryType = AssessmentSectionCategoryType.LowerLimitNorm }; // Call @@ -299,6 +306,7 @@ Assert.AreEqual(false, exportableWaveConditions.UseBreakWater); Assert.AreEqual(true, exportableWaveConditions.UseForeshore); Assert.AreEqual(CoverType.Asphalt, exportableWaveConditions.CoverType); + Assert.AreEqual("B->C", exportableWaveConditions.CategoryBoundaryName); Assert.AreEqual(2, exportableWaveConditions.WaterLevel.NumberOfDecimalPlaces); Assert.AreEqual(2, exportableWaveConditions.WaveHeight.NumberOfDecimalPlaces); Assert.AreEqual(2, exportableWaveConditions.WavePeriod.NumberOfDecimalPlaces); Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/ExportableWaveConditionsTest.cs =================================================================== diff -u -r760b664ea51c6769a826254059da09c04d3d32e8 -r70498755638c516e4a216d70b6d50efa898047fc --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/ExportableWaveConditionsTest.cs (.../ExportableWaveConditionsTest.cs) (revision 760b664ea51c6769a826254059da09c04d3d32e8) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/ExportableWaveConditionsTest.cs (.../ExportableWaveConditionsTest.cs) (revision 70498755638c516e4a216d70b6d50efa898047fc) @@ -38,7 +38,7 @@ public void Constructor_NameNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new ExportableWaveConditions(null, CreateValidWaveConditionsInput(), waveConditionsOutput, CoverType.StoneCoverColumns); + TestDelegate call = () => new ExportableWaveConditions(null, CreateValidWaveConditionsInput(), waveConditionsOutput, CoverType.StoneCoverColumns, string.Empty); // Assert var exception = Assert.Throws(call); @@ -49,7 +49,7 @@ public void Constructor_WaveConditionsInputNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new ExportableWaveConditions("aName", null, waveConditionsOutput, CoverType.StoneCoverColumns); + TestDelegate call = () => new ExportableWaveConditions("aName", null, waveConditionsOutput, CoverType.StoneCoverColumns, string.Empty); // Assert var exception = Assert.Throws(call); @@ -60,18 +60,40 @@ public void Constructor_WaveConditionsOutputNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new ExportableWaveConditions("aName", CreateValidWaveConditionsInput(), null, CoverType.StoneCoverColumns); + TestDelegate call = () => new ExportableWaveConditions("aName", CreateValidWaveConditionsInput(), null, CoverType.StoneCoverColumns, string.Empty); // Assert var exception = Assert.Throws(call); Assert.AreEqual("waveConditionsOutput", exception.ParamName); } [Test] + public void Constructor_CoverTypeNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new ExportableWaveConditions("aName", CreateValidWaveConditionsInput(), waveConditionsOutput, null, string.Empty); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("coverType", exception.ParamName); + } + + [Test] + public void Constructor_CategoryBoundaryNameNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new ExportableWaveConditions("aName", CreateValidWaveConditionsInput(), waveConditionsOutput, CoverType.Asphalt, null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("categoryBoundaryName", exception.ParamName); + } + + [Test] public void Constructor_WaveConditionsInputHydraulicBoundaryLocationNull_ThrowsArgumentException() { // Call - TestDelegate call = () => new ExportableWaveConditions("aName", new TestWaveConditionsInput(), waveConditionsOutput, CoverType.StoneCoverColumns); + TestDelegate call = () => new ExportableWaveConditions("aName", new TestWaveConditionsInput(), waveConditionsOutput, CoverType.StoneCoverColumns, string.Empty); // Assert var exception = Assert.Throws(call); @@ -86,6 +108,7 @@ [Values(true, false)] bool useForeshore) { // Setup + const string categoryBoundaryName = "category"; WaveConditionsInput waveConditionsInput = CreateValidWaveConditionsInput(); waveConditionsInput.UseBreakWater = useBreakWater; waveConditionsInput.UseForeshore = useForeshore; @@ -95,7 +118,8 @@ new ExportableWaveConditions("ewcName", waveConditionsInput, waveConditionsOutput, - CoverType.StoneCoverColumns); + CoverType.StoneCoverColumns, + categoryBoundaryName); // Assert Assert.AreEqual("ewcName", exportableWaveConditions.CalculationName); @@ -106,6 +130,7 @@ Assert.AreEqual(useBreakWater, exportableWaveConditions.UseBreakWater); Assert.AreEqual(useForeshore, exportableWaveConditions.UseForeshore); Assert.AreEqual(CoverType.StoneCoverColumns, exportableWaveConditions.CoverType); + Assert.AreEqual(categoryBoundaryName, exportableWaveConditions.CategoryBoundaryName); Assert.AreEqual(2, exportableWaveConditions.WaterLevel.NumberOfDecimalPlaces); Assert.AreEqual(2, exportableWaveConditions.WaveHeight.NumberOfDecimalPlaces); Assert.AreEqual(2, exportableWaveConditions.WavePeriod.NumberOfDecimalPlaces); @@ -124,6 +149,7 @@ [Values(true, false)] bool useForeshore) { // Setup + const string categoryBoundaryName = "category"; WaveConditionsInput waveConditionsInput = CreateValidWaveConditionsInput(); waveConditionsInput.ForeshoreProfile = new TestForeshoreProfile("profile"); waveConditionsInput.UseBreakWater = useBreakWater; @@ -134,7 +160,8 @@ new ExportableWaveConditions("ewcName", waveConditionsInput, waveConditionsOutput, - CoverType.StoneCoverColumns); + CoverType.StoneCoverColumns, + categoryBoundaryName); // Assert Assert.AreEqual("ewcName", exportableWaveConditions.CalculationName); @@ -145,6 +172,7 @@ Assert.AreEqual(useBreakWater, exportableWaveConditions.UseBreakWater); Assert.AreEqual(useForeshore, exportableWaveConditions.UseForeshore); Assert.AreEqual(CoverType.StoneCoverColumns, exportableWaveConditions.CoverType); + Assert.AreEqual(categoryBoundaryName, exportableWaveConditions.CategoryBoundaryName); Assert.AreEqual(2, exportableWaveConditions.WaterLevel.NumberOfDecimalPlaces); Assert.AreEqual(2, exportableWaveConditions.WaveHeight.NumberOfDecimalPlaces); Assert.AreEqual(2, exportableWaveConditions.WavePeriod.NumberOfDecimalPlaces); Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/WaveConditionsExporterBaseTest.cs =================================================================== diff -u -r0795b7c13c4e460b93e94ddeadbc7c74b04c08ea -r70498755638c516e4a216d70b6d50efa898047fc --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/WaveConditionsExporterBaseTest.cs (.../WaveConditionsExporterBaseTest.cs) (revision 0795b7c13c4e460b93e94ddeadbc7c74b04c08ea) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/WaveConditionsExporterBaseTest.cs (.../WaveConditionsExporterBaseTest.cs) (revision 70498755638c516e4a216d70b6d50efa898047fc) @@ -127,7 +127,7 @@ StepSize = WaveConditionsInputStepSize.One, LowerBoundaryWaterLevels = (RoundedDouble) 2.689, UpperBoundaryWaterLevels = (RoundedDouble) 77.8249863247 - }, CreateWaveConditionsOutputForExport(1.11111, 2.22222, 3.33333, 4.4, 5.5555555), CoverType.StoneCoverBlocks), + }, CreateWaveConditionsOutputForExport(1.11111, 2.22222, 3.33333, 4.4, 5.5555555), CoverType.StoneCoverBlocks, string.Empty), new ExportableWaveConditions("columnsName", new TestWaveConditionsInput { HydraulicBoundaryLocation = new HydraulicBoundaryLocation(8, "aLocation", 44, 123.456), @@ -136,7 +136,7 @@ StepSize = WaveConditionsInputStepSize.Half, LowerBoundaryWaterLevels = (RoundedDouble) 1.98699, UpperBoundaryWaterLevels = (RoundedDouble) 84.26548 - }, CreateWaveConditionsOutputForExport(3.33333, 1.11111, 4.44444, 2.2, 6.66666), CoverType.StoneCoverColumns) + }, CreateWaveConditionsOutputForExport(3.33333, 1.11111, 4.44444, 2.2, 6.66666), CoverType.StoneCoverColumns, string.Empty) }; string directoryPath = TestHelper.GetScratchPadPath(nameof(Export_ValidData_ValidFile)); Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/WaveConditionsWriterTest.cs =================================================================== diff -u -r0795b7c13c4e460b93e94ddeadbc7c74b04c08ea -r70498755638c516e4a216d70b6d50efa898047fc --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/WaveConditionsWriterTest.cs (.../WaveConditionsWriterTest.cs) (revision 0795b7c13c4e460b93e94ddeadbc7c74b04c08ea) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/WaveConditionsWriterTest.cs (.../WaveConditionsWriterTest.cs) (revision 70498755638c516e4a216d70b6d50efa898047fc) @@ -151,7 +151,7 @@ LowerBoundaryWaterLevels = (RoundedDouble) 2.689, UpperBoundaryWaterLevels = (RoundedDouble) 77.8249863247, UseBreakWater = true - }, CreateWaveConditionsOutputForExport(1.11111, 2.22222, 3.33333, 4.4, 5.5555555), CoverType.StoneCoverBlocks), + }, CreateWaveConditionsOutputForExport(1.11111, 2.22222, 3.33333, 4.4, 5.5555555), CoverType.StoneCoverBlocks, string.Empty), new ExportableWaveConditions("columnsName", new TestWaveConditionsInput { HydraulicBoundaryLocation = new HydraulicBoundaryLocation(8, "aLocation", 44, 123.456), @@ -160,7 +160,7 @@ StepSize = WaveConditionsInputStepSize.One, LowerBoundaryWaterLevels = (RoundedDouble) 1.98699, UpperBoundaryWaterLevels = (RoundedDouble) 84.26548 - }, CreateWaveConditionsOutputForExport(3.33333, 1.11111, 4.44444, 2.2, 6.66666), CoverType.StoneCoverColumns) + }, CreateWaveConditionsOutputForExport(3.33333, 1.11111, 4.44444, 2.2, 6.66666), CoverType.StoneCoverColumns, string.Empty) }; string directoryPath = TestHelper.GetScratchPadPath(nameof(WriteWaveConditions_ValidData_ValidFile));