Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs =================================================================== diff -u -r409352706e7ed14c76bb43304d262fa22d148160 -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs (.../ClosingStructuresCalculationServiceTest.cs) (revision 409352706e7ed14c76bb43304d262fa22d148160) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs (.../ClosingStructuresCalculationServiceTest.cs) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -353,10 +353,9 @@ } [Test] - [TestCase(true, false)] - [TestCase(true, true)] - [TestCase(false, false)] - public void Calculate_VariousVerticalWallCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater) + [TestCase(true)] + [TestCase(false)] + public void Calculate_VariousVerticalWallCalculationsWithoutBreakWater_InputPropertiesCorrectlySentToCalculator(bool useForeshore) { // Setup var failureMechanism = new ClosingStructuresFailureMechanism(); @@ -381,7 +380,7 @@ if (useForeshore) { - calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(useBreakWater); + calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(); } using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) @@ -405,7 +404,7 @@ 1300001, input.StructureNormalOrientation, useForeshore ? input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)) : new HydraRingForelandPoint[0], - useBreakWater ? new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height) : null, + null, generalInput.GravitationalAcceleration, input.FactorStormDurationOpenStructure, input.FailureProbabilityOpenStructure, @@ -435,10 +434,10 @@ } [Test] - [TestCase(true, false)] - [TestCase(true, true)] - [TestCase(false, false)] - public void Calculate_VariousLowSillCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater) + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Calculate_VariousVerticalWallCalculationsWithBreakWater_InputPropertiesCorrectlySentToCalculator(BreakWaterType breakWaterType) { // Setup var failureMechanism = new ClosingStructuresFailureMechanism(); @@ -458,13 +457,96 @@ InputParameters = { HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), + ForeshoreProfile = new TestForeshoreProfile(true) + { + BreakWater = + { + Type = breakWaterType + } + } + } + }; + + using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) + { + // Call + new ClosingStructuresCalculationService().Calculate(calculation, + failureMechanism.GeneralInput, + failureMechanism.GeneralInput.N, + assessmentSection.FailureMechanismContribution.Norm, + failureMechanism.Contribution, + validFilePath, + validPreprocessorDirectory); + + // Assert + StructuresClosureCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); + Assert.AreEqual(1, calculationInputs.Length); + + GeneralClosingStructuresInput generalInput = failureMechanism.GeneralInput; + ClosingStructuresInput input = calculation.InputParameters; + var expectedInput = new StructuresClosureVerticalWallCalculationInput( + 1300001, + input.StructureNormalOrientation, + input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), + generalInput.GravitationalAcceleration, + input.FactorStormDurationOpenStructure, + input.FailureProbabilityOpenStructure, + input.FailureProbabilityReparation, + input.IdenticalApertures, + input.AllowedLevelIncreaseStorage.Mean, input.AllowedLevelIncreaseStorage.StandardDeviation, + generalInput.ModelFactorStorageVolume.Mean, generalInput.ModelFactorStorageVolume.StandardDeviation, + input.StorageStructureArea.Mean, input.StorageStructureArea.CoefficientOfVariation, + generalInput.ModelFactorInflowVolume, + input.FlowWidthAtBottomProtection.Mean, input.FlowWidthAtBottomProtection.StandardDeviation, + input.CriticalOvertoppingDischarge.Mean, input.CriticalOvertoppingDischarge.CoefficientOfVariation, + input.FailureProbabilityStructureWithErosion, + input.StormDuration.Mean, input.StormDuration.CoefficientOfVariation, + input.ProbabilityOrFrequencyOpenStructureBeforeFlooding, + generalInput.ModelFactorOvertoppingFlow.Mean, generalInput.ModelFactorOvertoppingFlow.StandardDeviation, + input.StructureNormalOrientation, + input.ModelFactorSuperCriticalFlow.Mean, input.ModelFactorSuperCriticalFlow.StandardDeviation, + input.LevelCrestStructureNotClosing.Mean, input.LevelCrestStructureNotClosing.StandardDeviation, + input.WidthFlowApertures.Mean, input.WidthFlowApertures.StandardDeviation, + input.DeviationWaveDirection); + + var actualInput = (StructuresClosureVerticalWallCalculationInput) calculationInputs[0]; + HydraRingDataEqualityHelper.AreEqual(expectedInput, actualInput); + Assert.IsFalse(calculator.IsCanceled); + } + mockRepository.VerifyAll(); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Calculate_VariousLowSillCalculationsWithoutBreakWater_InputPropertiesCorrectlySentToCalculator(bool useForeshore) + { + // Setup + var failureMechanism = new ClosingStructuresFailureMechanism(); + + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, + mockRepository); + + var calculator = new TestStructuresCalculator(); + var calculatorFactory = mockRepository.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath, validPreprocessorDirectory)) + .Return(calculator); + mockRepository.ReplayAll(); + + var calculation = new TestClosingStructuresCalculation + { + InputParameters = + { + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), InflowModelType = ClosingStructureInflowModelType.LowSill } }; if (useForeshore) { - calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(useBreakWater); + calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(); } using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) @@ -488,7 +570,7 @@ 1300001, input.StructureNormalOrientation, useForeshore ? input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)) : new HydraRingForelandPoint[0], - useBreakWater ? new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height) : null, + null, generalInput.GravitationalAcceleration, input.FactorStormDurationOpenStructure, input.FailureProbabilityOpenStructure, @@ -517,17 +599,18 @@ } [Test] - [TestCase(true, false)] - [TestCase(true, true)] - [TestCase(false, false)] - public void Calculate_VariousFloodedCulvertCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater) + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Calculate_VariousLowSillCalculationsWithBreakWater_InputPropertiesCorrectlySentToCalculator(BreakWaterType breakWaterType) { // Setup var failureMechanism = new ClosingStructuresFailureMechanism(); var mockRepository = new MockRepository(); IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + var calculator = new TestStructuresCalculator(); var calculatorFactory = mockRepository.StrictMock(); calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath, validPreprocessorDirectory)) @@ -539,13 +622,95 @@ InputParameters = { HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), + InflowModelType = ClosingStructureInflowModelType.LowSill, + ForeshoreProfile = new TestForeshoreProfile(true) + { + BreakWater = + { + Type = breakWaterType + } + } + } + }; + + using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) + { + // Call + new ClosingStructuresCalculationService().Calculate(calculation, + failureMechanism.GeneralInput, + failureMechanism.GeneralInput.N, + assessmentSection.FailureMechanismContribution.Norm, + failureMechanism.Contribution, + validFilePath, + validPreprocessorDirectory); + + // Assert + StructuresClosureCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); + Assert.AreEqual(1, calculationInputs.Length); + + GeneralClosingStructuresInput generalInput = failureMechanism.GeneralInput; + ClosingStructuresInput input = calculation.InputParameters; + var expectedInput = new StructuresClosureLowSillCalculationInput( + 1300001, + input.StructureNormalOrientation, + input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), + generalInput.GravitationalAcceleration, + input.FactorStormDurationOpenStructure, + input.FailureProbabilityOpenStructure, + input.FailureProbabilityReparation, + input.IdenticalApertures, + input.AllowedLevelIncreaseStorage.Mean, input.AllowedLevelIncreaseStorage.StandardDeviation, + generalInput.ModelFactorStorageVolume.Mean, generalInput.ModelFactorStorageVolume.StandardDeviation, + input.StorageStructureArea.Mean, input.StorageStructureArea.CoefficientOfVariation, + generalInput.ModelFactorInflowVolume, + input.FlowWidthAtBottomProtection.Mean, input.FlowWidthAtBottomProtection.StandardDeviation, + input.CriticalOvertoppingDischarge.Mean, input.CriticalOvertoppingDischarge.CoefficientOfVariation, + input.FailureProbabilityStructureWithErosion, + input.StormDuration.Mean, input.StormDuration.CoefficientOfVariation, + input.ProbabilityOrFrequencyOpenStructureBeforeFlooding, + input.ModelFactorSuperCriticalFlow.Mean, input.ModelFactorSuperCriticalFlow.StandardDeviation, + generalInput.ModelFactorSubCriticalFlow.Mean, generalInput.ModelFactorSubCriticalFlow.CoefficientOfVariation, + input.ThresholdHeightOpenWeir.Mean, input.ThresholdHeightOpenWeir.StandardDeviation, + input.InsideWaterLevel.Mean, input.InsideWaterLevel.StandardDeviation, + input.WidthFlowApertures.Mean, input.WidthFlowApertures.StandardDeviation); + + var actualInput = (StructuresClosureLowSillCalculationInput) calculationInputs[0]; + HydraRingDataEqualityHelper.AreEqual(expectedInput, actualInput); + Assert.IsFalse(calculator.IsCanceled); + } + mockRepository.VerifyAll(); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Calculate_VariousFloodedCulvertCalculationsWithoutBreakWater_InputPropertiesCorrectlySentToCalculator(bool useForeshore) + { + // Setup + var failureMechanism = new ClosingStructuresFailureMechanism(); + + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, + mockRepository); + var calculator = new TestStructuresCalculator(); + var calculatorFactory = mockRepository.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath, validPreprocessorDirectory)) + .Return(calculator); + mockRepository.ReplayAll(); + + var calculation = new TestClosingStructuresCalculation + { + InputParameters = + { + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), InflowModelType = ClosingStructureInflowModelType.FloodedCulvert } }; if (useForeshore) { - calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(useBreakWater); + calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(); } using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) @@ -569,7 +734,7 @@ 1300001, input.StructureNormalOrientation, useForeshore ? input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)) : new HydraRingForelandPoint[0], - useBreakWater ? new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height) : null, + null, generalInput.GravitationalAcceleration, input.FactorStormDurationOpenStructure, input.FailureProbabilityOpenStructure, @@ -596,6 +761,87 @@ } [Test] + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Calculate_VariousFloodedCulvertCalculationsWithBreakWater_InputPropertiesCorrectlySentToCalculator(BreakWaterType breakWaterType) + { + // Setup + var failureMechanism = new ClosingStructuresFailureMechanism(); + + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, + mockRepository); + var calculator = new TestStructuresCalculator(); + var calculatorFactory = mockRepository.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath, validPreprocessorDirectory)) + .Return(calculator); + mockRepository.ReplayAll(); + + var calculation = new TestClosingStructuresCalculation + { + InputParameters = + { + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), + InflowModelType = ClosingStructureInflowModelType.FloodedCulvert, + ForeshoreProfile = new TestForeshoreProfile(true) + { + BreakWater = + { + Type = breakWaterType + } + } + } + }; + + using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) + { + // Call + new ClosingStructuresCalculationService().Calculate(calculation, + failureMechanism.GeneralInput, + failureMechanism.GeneralInput.N, + assessmentSection.FailureMechanismContribution.Norm, + failureMechanism.Contribution, + validFilePath, + validPreprocessorDirectory); + + // Assert + StructuresClosureCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); + Assert.AreEqual(1, calculationInputs.Length); + + GeneralClosingStructuresInput generalInput = failureMechanism.GeneralInput; + ClosingStructuresInput input = calculation.InputParameters; + var expectedInput = new StructuresClosureFloodedCulvertCalculationInput( + 1300001, + input.StructureNormalOrientation, + input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), + generalInput.GravitationalAcceleration, + input.FactorStormDurationOpenStructure, + input.FailureProbabilityOpenStructure, + input.FailureProbabilityReparation, + input.IdenticalApertures, + input.AllowedLevelIncreaseStorage.Mean, input.AllowedLevelIncreaseStorage.StandardDeviation, + generalInput.ModelFactorStorageVolume.Mean, generalInput.ModelFactorStorageVolume.StandardDeviation, + input.StorageStructureArea.Mean, input.StorageStructureArea.CoefficientOfVariation, + generalInput.ModelFactorInflowVolume, + input.FlowWidthAtBottomProtection.Mean, input.FlowWidthAtBottomProtection.StandardDeviation, + input.CriticalOvertoppingDischarge.Mean, input.CriticalOvertoppingDischarge.CoefficientOfVariation, + input.FailureProbabilityStructureWithErosion, + input.StormDuration.Mean, input.StormDuration.CoefficientOfVariation, + input.ProbabilityOrFrequencyOpenStructureBeforeFlooding, + input.DrainCoefficient.Mean, input.DrainCoefficient.StandardDeviation, + input.AreaFlowApertures.Mean, input.AreaFlowApertures.StandardDeviation, + input.InsideWaterLevel.Mean, input.InsideWaterLevel.StandardDeviation); + + var actualInput = (StructuresClosureFloodedCulvertCalculationInput) calculationInputs[0]; + HydraRingDataEqualityHelper.AreEqual(expectedInput, actualInput); + Assert.IsFalse(calculator.IsCanceled); + } + mockRepository.VerifyAll(); + } + + [Test] [Combinatorial] public void Calculate_PreprocessorDirectorySet_InputPropertiesCorrectlySentToCalculator([Values(true, false)] bool usePreprocessor) { Index: Ringtoets/Common/src/Ringtoets.Common.Service/HydraRingInputParser.cs =================================================================== diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/Common/src/Ringtoets.Common.Service/HydraRingInputParser.cs (.../HydraRingInputParser.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1) +++ Ringtoets/Common/src/Ringtoets.Common.Service/HydraRingInputParser.cs (.../HydraRingInputParser.cs) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -19,7 +19,9 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.HydraRing.Calculation.Data; @@ -49,9 +51,38 @@ /// A calculation input object that implements . /// A object, null if /// is false + /// Thrown when the break water type is an invalid value. + /// Thrown when the break water type is a valid value but unsupported. public static HydraRingBreakWater ParseBreakWater(IUseBreakWater input) { - return input.UseBreakWater ? new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height) : null; + return input.UseBreakWater ? new HydraRingBreakWater(ConvertBreakWaterType(input.BreakWater.Type), input.BreakWater.Height) : null; } + + /// + /// Converts into an integer value to be used by Hydra-Ring. + /// + /// The to convert. + /// The integer value to be used by Hydra-Ring. + /// Thrown when is an invalid value. + /// Thrown when is a valid value but unsupported. + private static int ConvertBreakWaterType(BreakWaterType type) + { + if (!Enum.IsDefined(type.GetType(), type)) + { + throw new InvalidEnumArgumentException(nameof(type), (int) type, type.GetType()); + } + + switch (type) + { + case BreakWaterType.Caisson: + return 1; + case BreakWaterType.Wall: + return 2; + case BreakWaterType.Dam: + return 3; + default: + throw new NotSupportedException($"Value '{type}' is not supported."); + } + } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/HydraRingInputParserTest.cs =================================================================== diff -u -r1bbf51443c907b5f202e80764fa05f2e7f842c04 -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/HydraRingInputParserTest.cs (.../HydraRingInputParserTest.cs) (revision 1bbf51443c907b5f202e80764fa05f2e7f842c04) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/HydraRingInputParserTest.cs (.../HydraRingInputParserTest.cs) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -21,13 +21,16 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Service.TestUtil; using Ringtoets.HydraRing.Calculation.Data; namespace Ringtoets.Common.Service.Test @@ -83,8 +86,8 @@ } [Test] - [TestCase(BreakWaterType.Wall)] [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] [TestCase(BreakWaterType.Dam)] public void ParseBreakWater_Use_ReturnHydraRingBreakWater(BreakWaterType breakWaterType) { @@ -103,14 +106,14 @@ HydraRingBreakWater parsedBreakWater = HydraRingInputParser.ParseBreakWater(breakWater); // Assert - Assert.AreEqual((int) expectedBreakWater.Type, parsedBreakWater.Type); + Assert.AreEqual(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), parsedBreakWater.Type); Assert.AreEqual(expectedBreakWater.Height, parsedBreakWater.Height, expectedBreakWater.Height.GetAccuracy()); mockRepository.VerifyAll(); } [Test] - [TestCase(BreakWaterType.Wall)] [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] [TestCase(BreakWaterType.Dam)] public void ParseBreakWater_DoesNotUse_ReturnNull(BreakWaterType breakWaterType) { @@ -127,5 +130,27 @@ Assert.IsNull(parsedBreakWater); mockRepository.VerifyAll(); } + + [Test] + public void ParseBreakWater_InvalidBreakWaterType_ThrowInvalidEnumArgumentException() + { + // Setup + var random = new Random(22); + var mockRepository = new MockRepository(); + var breakWater = mockRepository.Stub(); + breakWater.UseBreakWater = true; + var expectedBreakWater = new BreakWater((BreakWaterType) 99, random.NextDouble()); + breakWater.Stub(call => call.BreakWater).Return(expectedBreakWater); + mockRepository.ReplayAll(); + + // Call + TestDelegate test = () => HydraRingInputParser.ParseBreakWater(breakWater); + + // Assert + string message = $"The value of argument 'type' ({99}) is invalid for Enum type '{typeof(BreakWaterType).Name}'."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, message); + + mockRepository.VerifyAll(); + } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Service.TestUtil.Test/BreakWaterTypeHelperTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Service.TestUtil.Test/BreakWaterTypeHelperTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Service.TestUtil.Test/BreakWaterTypeHelperTest.cs (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -0,0 +1,45 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Ringtoets.Common.Data.DikeProfiles; + +namespace Ringtoets.Common.Service.TestUtil.Test +{ + [TestFixture] + public class BreakWaterTypeHelperTest + { + [Test] + [TestCase((BreakWaterType) 0, 0)] + [TestCase(BreakWaterType.Caisson, 1)] + [TestCase(BreakWaterType.Wall, 2)] + [TestCase(BreakWaterType.Dam, 3)] + [TestCase((BreakWaterType) 99, 0)] + public void GetHydraRingBreakWaterType(BreakWaterType breakWaterType, int expectedBreakWaterType) + { + // Call + int actualBreakWaterType = BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType); + + // Assert + Assert.AreEqual(expectedBreakWaterType, actualBreakWaterType); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Service.TestUtil.Test/Ringtoets.Common.Service.TestUtil.Test.csproj =================================================================== diff -u -r04f5526f955c773d4987e820e2aca2614dfbd8d8 -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/Common/test/Ringtoets.Common.Service.TestUtil.Test/Ringtoets.Common.Service.TestUtil.Test.csproj (.../Ringtoets.Common.Service.TestUtil.Test.csproj) (revision 04f5526f955c773d4987e820e2aca2614dfbd8d8) +++ Ringtoets/Common/test/Ringtoets.Common.Service.TestUtil.Test/Ringtoets.Common.Service.TestUtil.Test.csproj (.../Ringtoets.Common.Service.TestUtil.Test.csproj) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -46,6 +46,7 @@ Properties\GlobalAssembly.cs + Index: Ringtoets/Common/test/Ringtoets.Common.Service.TestUtil/BreakWaterTypeHelper.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Service.TestUtil/BreakWaterTypeHelper.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Service.TestUtil/BreakWaterTypeHelper.cs (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -0,0 +1,51 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Ringtoets.Common.Data.DikeProfiles; + +namespace Ringtoets.Common.Service.TestUtil +{ + /// + /// A helper to be used while asserting Hydra-Ring break water types. + /// + public static class BreakWaterTypeHelper + { + /// + /// Gets the Hydra-Ring integer value corresponding to . + /// + /// The to get the Hydra-Ring value for. + /// A Hydra-Ring specific integer value. + public static int GetHydraRingBreakWaterType(BreakWaterType type) + { + switch (type) + { + case BreakWaterType.Caisson: + return 1; + case BreakWaterType.Wall: + return 2; + case BreakWaterType.Dam: + return 3; + default: + return 0; + } + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Service.TestUtil/Ringtoets.Common.Service.TestUtil.csproj =================================================================== diff -u -r04f5526f955c773d4987e820e2aca2614dfbd8d8 -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/Common/test/Ringtoets.Common.Service.TestUtil/Ringtoets.Common.Service.TestUtil.csproj (.../Ringtoets.Common.Service.TestUtil.csproj) (revision 04f5526f955c773d4987e820e2aca2614dfbd8d8) +++ Ringtoets/Common/test/Ringtoets.Common.Service.TestUtil/Ringtoets.Common.Service.TestUtil.csproj (.../Ringtoets.Common.Service.TestUtil.csproj) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -46,6 +46,7 @@ Properties\GlobalAssembly.cs + Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs =================================================================== diff -u -r409352706e7ed14c76bb43304d262fa22d148160 -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs (.../GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs) (revision 409352706e7ed14c76bb43304d262fa22d148160) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Integration.Test/GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs (.../GrassCoverErosionInwardsCalculationActivityIntegrationTest.cs) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -205,18 +205,24 @@ #region Overtopping calculations [Test] - public void Run_ValidOvertoppingCalculation_InputPropertiesCorrectlySendToService() + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Run_ValidOvertoppingCalculation_InputPropertiesCorrectlySendToService(BreakWaterType breakWaterType) { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); ImportHydraulicBoundaryDatabase(assessmentSection); + DikeProfile dikeProfile = CreateDikeProfile(); + dikeProfile.BreakWater.Type = breakWaterType; + var calculation = new GrassCoverErosionInwardsCalculation { InputParameters = { HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), - DikeProfile = CreateDikeProfile() + DikeProfile = dikeProfile } }; @@ -245,7 +251,7 @@ calculation.InputParameters.Orientation, calculation.InputParameters.DikeGeometry.Select(roughnessPoint => new HydraRingRoughnessProfilePoint(roughnessPoint.Point.X, roughnessPoint.Point.Y, roughnessPoint.Roughness)), input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), - new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), calculation.InputParameters.DikeHeight, generalInput.CriticalOvertoppingModelFactor, generalInput.FbFactor.Mean, @@ -479,9 +485,12 @@ #region Dike height calculations [Test] - [TestCase(DikeHeightCalculationType.CalculateByAssessmentSectionNorm, TestName = "Run_ValidDikeHeight_InputPropertiesCorrectlySendToService(Norm)")] - [TestCase(DikeHeightCalculationType.CalculateByProfileSpecificRequiredProbability, TestName = "Run_ValidDikeHeight_InputPropertiesCorrectlySendToService(RequiredProbability)")] - public void Run_ValidDikeHeightCalculation_InputPropertiesCorrectlySendToService(DikeHeightCalculationType dikeHeightCalculationType) + public void Run_ValidDikeHeightCalculation_InputPropertiesCorrectlySendToService( + [Values(BreakWaterType.Caisson, + BreakWaterType.Wall, + BreakWaterType.Dam)] BreakWaterType breakWaterType, + [Values(DikeHeightCalculationType.CalculateByAssessmentSectionNorm, + DikeHeightCalculationType.CalculateByProfileSpecificRequiredProbability)] DikeHeightCalculationType dikeHeightCalculationType) { // Setup var dikeHeightCalculator = new TestHydraulicLoadsCalculator(); @@ -495,12 +504,15 @@ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); ImportHydraulicBoundaryDatabase(assessmentSection); + DikeProfile dikeProfile = CreateDikeProfile(); + dikeProfile.BreakWater.Type = breakWaterType; + var calculation = new GrassCoverErosionInwardsCalculation { InputParameters = { HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), - DikeProfile = CreateDikeProfile(), + DikeProfile = dikeProfile, DikeHeightCalculationType = dikeHeightCalculationType } }; @@ -533,7 +545,7 @@ calculation.InputParameters.Orientation, calculation.InputParameters.DikeGeometry.Select(roughnessPoint => new HydraRingRoughnessProfilePoint(roughnessPoint.Point.X, roughnessPoint.Point.Y, roughnessPoint.Roughness)), input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), - new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), generalInput.CriticalOvertoppingModelFactor, generalInput.FbFactor.Mean, generalInput.FbFactor.StandardDeviation, @@ -902,9 +914,12 @@ #region Overtopping rate calculations [Test] - [TestCase(OvertoppingRateCalculationType.CalculateByAssessmentSectionNorm, TestName = "Run_ValidOvertoppingRate_InputPropertiesCorrectlySendToService(Norm)")] - [TestCase(OvertoppingRateCalculationType.CalculateByProfileSpecificRequiredProbability, TestName = "Run_ValidOvertoppingRate_InputPropertiesCorrectlySendToService(RequiredProbability)")] - public void Run_ValidOvertoppingRateCalculation_InputPropertiesCorrectlySendToService(OvertoppingRateCalculationType overtoppingRateCalculationType) + public void Run_ValidOvertoppingRateCalculation_InputPropertiesCorrectlySendToService( + [Values(BreakWaterType.Caisson, + BreakWaterType.Wall, + BreakWaterType.Dam)] BreakWaterType breakWaterType, + [Values(OvertoppingRateCalculationType.CalculateByAssessmentSectionNorm, + OvertoppingRateCalculationType.CalculateByProfileSpecificRequiredProbability)] OvertoppingRateCalculationType overtoppingRateCalculationType) { // Setup var overtoppingRateCalculator = new TestHydraulicLoadsCalculator(); @@ -918,12 +933,15 @@ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); ImportHydraulicBoundaryDatabase(assessmentSection); + DikeProfile dikeProfile = CreateDikeProfile(); + dikeProfile.BreakWater.Type = breakWaterType; + var calculation = new GrassCoverErosionInwardsCalculation { InputParameters = { HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), - DikeProfile = CreateDikeProfile(), + DikeProfile = dikeProfile, OvertoppingRateCalculationType = overtoppingRateCalculationType } }; @@ -956,7 +974,7 @@ calculation.InputParameters.Orientation, calculation.InputParameters.DikeGeometry.Select(roughnessPoint => new HydraRingRoughnessProfilePoint(roughnessPoint.Point.X, roughnessPoint.Point.Y, roughnessPoint.Roughness)), input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), - new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), calculation.InputParameters.DikeHeight, generalInput.CriticalOvertoppingModelFactor, generalInput.FbFactor.Mean, Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs =================================================================== diff -u -r409352706e7ed14c76bb43304d262fa22d148160 -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs) (revision 409352706e7ed14c76bb43304d262fa22d148160) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationActivityIntegrationTest.cs) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -29,6 +29,7 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.IO.FileImporters; @@ -260,13 +261,17 @@ } [Test] - public void Run_Always_InputPropertiesCorrectlySendToService() + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Run_Always_InputPropertiesCorrectlySendToService(BreakWaterType breakWaterType) { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); ImportHydraulicBoundaryDatabase(assessmentSection); GrassCoverErosionOutwardsWaveConditionsCalculation calculation = GetValidCalculation(assessmentSection); + calculation.InputParameters.BreakWater.Type = breakWaterType; var activity = new GrassCoverErosionOutwardsWaveConditionsCalculationActivity(calculation, validFilePath, @@ -309,7 +314,7 @@ input.HydraulicBoundaryLocation.Id, mechanismSpecificNorm, input.ForeshoreProfile.Geometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), - new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), calculation.InputParameters.WaterLevels.ElementAt(waterLevelIndex++), generalInput.GeneralWaveConditionsInput.A, generalInput.GeneralWaveConditionsInput.B, Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs =================================================================== diff -u -r571bf6cd20fe3f02f6fe5a51495c3336e226cbbb -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs) (revision 571bf6cd20fe3f02f6fe5a51495c3336e226cbbb) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Service.Test/GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationServiceTest.cs) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -524,10 +524,15 @@ } [Test] - public void Calculate_Always_InputPropertiesCorrectlySendToCalculator() + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Calculate_Always_InputPropertiesCorrectlySendToCalculator(BreakWaterType breakWaterType) { // Setup GrassCoverErosionOutwardsWaveConditionsCalculation calculation = GetValidCalculation(); + calculation.InputParameters.BreakWater.Type = breakWaterType; + var grassCoverErosionOutwardsFailureMechanism = new GrassCoverErosionOutwardsFailureMechanism { Contribution = 20 @@ -569,7 +574,7 @@ input.HydraulicBoundaryLocation.Id, mechanismSpecificNorm, input.ForeshoreProfile.Geometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), - new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), calculation.InputParameters.WaterLevels.ElementAt(waterLevelIndex++), generalInput.GeneralWaveConditionsInput.A, generalInput.GeneralWaveConditionsInput.B, Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresCalculationServiceTest.cs =================================================================== diff -u -r409352706e7ed14c76bb43304d262fa22d148160 -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresCalculationServiceTest.cs (.../HeightStructuresCalculationServiceTest.cs) (revision 409352706e7ed14c76bb43304d262fa22d148160) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresCalculationServiceTest.cs (.../HeightStructuresCalculationServiceTest.cs) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -484,10 +484,9 @@ } [Test] - [TestCase(true, false)] - [TestCase(true, true)] - [TestCase(false, false)] - public void Calculate_VariousCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater) + [TestCase(true)] + [TestCase(false)] + public void Calculate_VariousCalculationsWithoutBreakWater_InputPropertiesCorrectlySentToCalculator(bool useForeshore) { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); @@ -511,7 +510,7 @@ if (useForeshore) { - calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(useBreakWater); + calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(); } using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) @@ -535,7 +534,7 @@ 1300001, input.StructureNormalOrientation, useForeshore ? input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)) : new HydraRingForelandPoint[0], - useBreakWater ? new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height) : null, + null, generalInput.GravitationalAcceleration, generalInput.ModelFactorOvertoppingFlow.Mean, generalInput.ModelFactorOvertoppingFlow.StandardDeviation, input.LevelCrestStructure.Mean, input.LevelCrestStructure.StandardDeviation, @@ -560,30 +559,35 @@ } [Test] - [Combinatorial] - public void Calculate_PreprocessorDirectorySet_InputPropertiesCorrectlySentToCalculator([Values(true, false)] bool usePreprocessor) + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Calculate_VariousCalculationsWithBreakWater_InputPropertiesCorrectlySentToCalculator(BreakWaterType breakWaterType) { // Setup - string preprocessorDirectory = usePreprocessor - ? validPreprocessorDirectory - : string.Empty; - var failureMechanism = new HeightStructuresFailureMechanism(); var mockRepository = new MockRepository(); - IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, - mockRepository); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + var calculator = new TestStructuresCalculator(); var calculatorFactory = mockRepository.StrictMock(); - calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath, preprocessorDirectory)) + calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath, validPreprocessorDirectory)) .Return(calculator); mockRepository.ReplayAll(); var calculation = new TestHeightStructuresCalculation { InputParameters = { - HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001) + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), + ForeshoreProfile = new TestForeshoreProfile(true) + { + BreakWater = + { + Type = breakWaterType + } + } } }; @@ -596,14 +600,38 @@ assessmentSection.FailureMechanismContribution.Norm, failureMechanism.Contribution, validFilePath, - preprocessorDirectory); + validPreprocessorDirectory); // Assert - StructuresOvertoppingCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); - Assert.AreEqual(1, calculationInputs.Length); + StructuresOvertoppingCalculationInput[] overtoppingCalculationInputs = calculator.ReceivedInputs.ToArray(); + Assert.AreEqual(1, overtoppingCalculationInputs.Length); - StructuresOvertoppingCalculationInput actualInput = calculationInputs[0]; - Assert.AreEqual(usePreprocessor, actualInput.PreprocessorSetting.RunPreprocessor); + GeneralHeightStructuresInput generalInput = failureMechanism.GeneralInput; + HeightStructuresInput input = calculation.InputParameters; + var expectedInput = new StructuresOvertoppingCalculationInput( + 1300001, + input.StructureNormalOrientation, + input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), + generalInput.GravitationalAcceleration, + generalInput.ModelFactorOvertoppingFlow.Mean, generalInput.ModelFactorOvertoppingFlow.StandardDeviation, + input.LevelCrestStructure.Mean, input.LevelCrestStructure.StandardDeviation, + input.StructureNormalOrientation, + input.ModelFactorSuperCriticalFlow.Mean, input.ModelFactorSuperCriticalFlow.StandardDeviation, + input.AllowedLevelIncreaseStorage.Mean, input.AllowedLevelIncreaseStorage.StandardDeviation, + generalInput.ModelFactorStorageVolume.Mean, generalInput.ModelFactorStorageVolume.StandardDeviation, + input.StorageStructureArea.Mean, input.StorageStructureArea.CoefficientOfVariation, + generalInput.ModelFactorInflowVolume, + input.FlowWidthAtBottomProtection.Mean, input.FlowWidthAtBottomProtection.StandardDeviation, + input.CriticalOvertoppingDischarge.Mean, input.CriticalOvertoppingDischarge.CoefficientOfVariation, + input.FailureProbabilityStructureWithErosion, + input.WidthFlowApertures.Mean, input.WidthFlowApertures.StandardDeviation, + input.DeviationWaveDirection, + input.StormDuration.Mean, input.StormDuration.CoefficientOfVariation); + + StructuresOvertoppingCalculationInput actualInput = overtoppingCalculationInputs[0]; + HydraRingDataEqualityHelper.AreEqual(expectedInput, actualInput); + Assert.IsFalse(calculator.IsCanceled); } mockRepository.VerifyAll(); } @@ -810,6 +838,54 @@ mockRepository.VerifyAll(); } + [Combinatorial] + public void Calculate_PreprocessorDirectorySet_InputPropertiesCorrectlySentToCalculator([Values(true, false)] bool usePreprocessor) + { + // Setup + string preprocessorDirectory = usePreprocessor + ? validPreprocessorDirectory + : string.Empty; + + var failureMechanism = new HeightStructuresFailureMechanism(); + + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, + mockRepository); + var calculator = new TestStructuresCalculator(); + var calculatorFactory = mockRepository.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath, preprocessorDirectory)) + .Return(calculator); + mockRepository.ReplayAll(); + + var calculation = new TestHeightStructuresCalculation + { + InputParameters = + { + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001) + } + }; + + using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) + { + // Call + new HeightStructuresCalculationService().Calculate(calculation, + failureMechanism.GeneralInput, + failureMechanism.GeneralInput.N, + assessmentSection.FailureMechanismContribution.Norm, + failureMechanism.Contribution, + validFilePath, + preprocessorDirectory); + + // Assert + StructuresOvertoppingCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); + Assert.AreEqual(1, calculationInputs.Length); + + StructuresOvertoppingCalculationInput actualInput = calculationInputs[0]; + Assert.AreEqual(usePreprocessor, actualInput.PreprocessorSetting.RunPreprocessor); + } + mockRepository.VerifyAll(); + } + #region Test cases private static IEnumerable NormalDistributionsWithInvalidMean Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Service.Test/WaveConditionsCalculationServiceBaseTest.cs =================================================================== diff -u -r409352706e7ed14c76bb43304d262fa22d148160 -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/Revetment/test/Ringtoets.Revetment.Service.Test/WaveConditionsCalculationServiceBaseTest.cs (.../WaveConditionsCalculationServiceBaseTest.cs) (revision 409352706e7ed14c76bb43304d262fa22d148160) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.Service.Test/WaveConditionsCalculationServiceBaseTest.cs (.../WaveConditionsCalculationServiceBaseTest.cs) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -443,10 +443,9 @@ } [Test] - [Combinatorial] - public void Calculate_Always_StartsCalculationWithRightParameters( - [Values(true, false)] bool useForeshore, - [Values(true, false)] bool useBreakWater) + [TestCase(true)] + [TestCase(false)] + public void Calculate_WithoutBreakWater_StartsCalculationWithRightParameters(bool useForeshore) { // Setup var waterLevel = (RoundedDouble) 4.20; @@ -461,7 +460,7 @@ UpperBoundaryRevetment = (RoundedDouble) 4, LowerBoundaryRevetment = (RoundedDouble) 3, StepSize = WaveConditionsInputStepSize.Two, - UseBreakWater = useBreakWater, + UseBreakWater = false, UseForeshore = useForeshore, Orientation = (RoundedDouble) 0 }; @@ -487,14 +486,70 @@ // Assert for (var i = 0; i < nrOfCalculators; i++) { - WaveConditionsCosineCalculationInput expectedInput = CreateInput(input.WaterLevels.ElementAt(i), a, b, c, norm, input, useForeshore, useBreakWater); + WaveConditionsCosineCalculationInput expectedInput = CreateInput(input.WaterLevels.ElementAt(i), a, b, c, norm, input, useForeshore, false); HydraRingDataEqualityHelper.AreEqual(expectedInput, calculator.ReceivedInputs[i]); } } mockRepository.VerifyAll(); } [Test] + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Calculate_WithBreakWater_StartsCalculationWithRightParameters(BreakWaterType breakWaterType) + { + // Setup + var waterLevel = (RoundedDouble) 4.20; + var a = (RoundedDouble) 1.0; + var b = (RoundedDouble) 0.8; + var c = (RoundedDouble) 0.4; + const double norm = 0.2; + var input = new WaveConditionsInput + { + HydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(waterLevel), + ForeshoreProfile = new TestForeshoreProfile(true), + UpperBoundaryRevetment = (RoundedDouble) 4, + LowerBoundaryRevetment = (RoundedDouble) 3, + StepSize = WaveConditionsInputStepSize.Two, + UseBreakWater = true, + UseForeshore = true, + Orientation = (RoundedDouble) 0, + BreakWater = + { + Type = breakWaterType + } + }; + + string hcldFilePath = Path.Combine(testDataPath, "HRD ijsselmeer.sqlite"); + + var calculator = new TestWaveConditionsCosineCalculator(); + int nrOfCalculators = input.WaterLevels.Count(); + + var mockRepository = new MockRepository(); + var calculatorFactory = mockRepository.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateWaveConditionsCosineCalculator(testDataPath, validPreprocessorDirectory)) + .Return(calculator) + .Repeat + .Times(nrOfCalculators); + mockRepository.ReplayAll(); + + using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) + { + // Call + new WaveConditionsCalculationService().PublicCalculate(a, b, c, norm, input, hcldFilePath, validPreprocessorDirectory); + + // Assert + for (var i = 0; i < nrOfCalculators; i++) + { + WaveConditionsCosineCalculationInput expectedInput = CreateInput(input.WaterLevels.ElementAt(i), a, b, c, norm, input, true, true); + HydraRingDataEqualityHelper.AreEqual(expectedInput, calculator.ReceivedInputs[i]); + } + } + mockRepository.VerifyAll(); + } + + [Test] [TestCase(true)] [TestCase(false)] public void Calculate_PreprocessorDirectorySet_StartsCalculationWithRightParameters(bool usePreprocessor) @@ -778,7 +833,7 @@ ? input.ForeshoreGeometry.Select(coordinate => new HydraRingForelandPoint(coordinate.X, coordinate.Y)) : new HydraRingForelandPoint[0], useBreakWater - ? new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height) + ? new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(input.BreakWater.Type), input.BreakWater.Height) : null, waterLevel, a, Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationServiceTest.cs =================================================================== diff -u -r409352706e7ed14c76bb43304d262fa22d148160 -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationServiceTest.cs (.../StabilityPointStructuresCalculationServiceTest.cs) (revision 409352706e7ed14c76bb43304d262fa22d148160) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationServiceTest.cs (.../StabilityPointStructuresCalculationServiceTest.cs) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -590,10 +590,9 @@ } [Test] - [TestCase(true, false)] - [TestCase(true, true)] - [TestCase(false, false)] - public void Calculate_VariousLowSillLinearCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater) + [TestCase(true)] + [TestCase(false)] + public void Calculate_VariousLowSillLinearCalculationsWithoutBreakWater_InputPropertiesCorrectlySentToCalculator(bool useForeshore) { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); @@ -619,7 +618,7 @@ if (useForeshore) { - calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(useBreakWater); + calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(); } using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) @@ -643,7 +642,7 @@ 1300001, input.StructureNormalOrientation, useForeshore ? input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)) : new HydraRingForelandPoint[0], - useBreakWater ? new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height) : null, + null, input.VolumicWeightWater, generalInput.GravitationalAcceleration, input.LevelCrestStructure.Mean, @@ -712,10 +711,10 @@ } [Test] - [TestCase(true, false)] - [TestCase(true, true)] - [TestCase(false, false)] - public void Calculate_VariousLowSillQuadraticCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater) + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Calculate_VariousLowSillLinearCalculationsWithBreakWater_InputPropertiesCorrectlySentToCalculator(BreakWaterType breakWaterType) { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); @@ -735,13 +734,136 @@ { HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), InflowModelType = StabilityPointStructureInflowModelType.LowSill, + LoadSchematizationType = LoadSchematizationType.Linear, + ForeshoreProfile = new TestForeshoreProfile(true) + { + BreakWater = + { + Type = breakWaterType + } + } + } + }; + + using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) + { + // Call + new StabilityPointStructuresCalculationService().Calculate(calculation, + failureMechanism.GeneralInput, + failureMechanism.GeneralInput.N, + assessmentSection.FailureMechanismContribution.Norm, + failureMechanism.Contribution, + validFilePath, + validPreprocessorDirectory); + + // Assert + StructuresStabilityPointCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); + Assert.AreEqual(1, calculationInputs.Length); + + GeneralStabilityPointStructuresInput generalInput = failureMechanism.GeneralInput; + StabilityPointStructuresInput input = calculation.InputParameters; + var expectedInput = new StructuresStabilityPointLowSillLinearCalculationInput( + 1300001, + input.StructureNormalOrientation, + input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), + input.VolumicWeightWater, + generalInput.GravitationalAcceleration, + input.LevelCrestStructure.Mean, + input.LevelCrestStructure.StandardDeviation, + input.StructureNormalOrientation, + input.FactorStormDurationOpenStructure, + generalInput.ModelFactorSubCriticalFlow.Mean, + generalInput.ModelFactorSubCriticalFlow.CoefficientOfVariation, + input.ThresholdHeightOpenWeir.Mean, + input.ThresholdHeightOpenWeir.StandardDeviation, + input.InsideWaterLevelFailureConstruction.Mean, + input.InsideWaterLevelFailureConstruction.StandardDeviation, + input.FailureProbabilityRepairClosure, + input.FailureCollisionEnergy.Mean, + input.FailureCollisionEnergy.CoefficientOfVariation, + generalInput.ModelFactorCollisionLoad.Mean, + generalInput.ModelFactorCollisionLoad.CoefficientOfVariation, + input.ShipMass.Mean, + input.ShipMass.CoefficientOfVariation, + input.ShipVelocity.Mean, + input.ShipVelocity.CoefficientOfVariation, + input.LevellingCount, + input.ProbabilityCollisionSecondaryStructure, + input.FlowVelocityStructureClosable.Mean, + input.FlowVelocityStructureClosable.CoefficientOfVariation, + input.InsideWaterLevel.Mean, + input.InsideWaterLevel.StandardDeviation, + input.AllowedLevelIncreaseStorage.Mean, + input.AllowedLevelIncreaseStorage.StandardDeviation, + generalInput.ModelFactorStorageVolume.Mean, + generalInput.ModelFactorStorageVolume.StandardDeviation, + input.StorageStructureArea.Mean, + input.StorageStructureArea.CoefficientOfVariation, + generalInput.ModelFactorInflowVolume, + input.FlowWidthAtBottomProtection.Mean, + input.FlowWidthAtBottomProtection.StandardDeviation, + input.CriticalOvertoppingDischarge.Mean, + input.CriticalOvertoppingDischarge.CoefficientOfVariation, + input.FailureProbabilityStructureWithErosion, + input.StormDuration.Mean, + input.StormDuration.CoefficientOfVariation, + input.BankWidth.Mean, + input.BankWidth.StandardDeviation, + input.EvaluationLevel, + generalInput.ModelFactorLoadEffect.Mean, + generalInput.ModelFactorLoadEffect.StandardDeviation, + generalInput.WaveRatioMaxHN, + generalInput.WaveRatioMaxHStandardDeviation, + input.VerticalDistance, + generalInput.ModificationFactorWavesSlowlyVaryingPressureComponent, + generalInput.ModificationFactorDynamicOrImpulsivePressureComponent, + input.ModelFactorSuperCriticalFlow.Mean, + input.ModelFactorSuperCriticalFlow.StandardDeviation, + input.ConstructiveStrengthLinearLoadModel.Mean, + input.ConstructiveStrengthLinearLoadModel.CoefficientOfVariation, + input.StabilityLinearLoadModel.Mean, + input.StabilityLinearLoadModel.CoefficientOfVariation, + input.WidthFlowApertures.Mean, + input.WidthFlowApertures.StandardDeviation); + + var actualInput = (StructuresStabilityPointLowSillLinearCalculationInput) calculationInputs[0]; + HydraRingDataEqualityHelper.AreEqual(expectedInput, actualInput); + Assert.IsFalse(calculator.IsCanceled); + } + mockRepository.VerifyAll(); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Calculate_VariousLowSillQuadraticCalculationsWithoutBreakWater_InputPropertiesCorrectlySentToCalculator(bool useForeshore) + { + // Setup + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + + var calculator = new TestStructuresCalculator(); + var calculatorFactory = mockRepository.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath, validPreprocessorDirectory)) + .Return(calculator); + mockRepository.ReplayAll(); + + var calculation = new TestStabilityPointStructuresCalculation + { + InputParameters = + { + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), + InflowModelType = StabilityPointStructureInflowModelType.LowSill, LoadSchematizationType = LoadSchematizationType.Quadratic } }; if (useForeshore) { - calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(useBreakWater); + calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(); } using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) @@ -765,7 +887,7 @@ 1300001, input.StructureNormalOrientation, useForeshore ? input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)) : new HydraRingForelandPoint[0], - useBreakWater ? new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height) : null, + null, input.VolumicWeightWater, generalInput.GravitationalAcceleration, input.LevelCrestStructure.Mean, @@ -834,10 +956,10 @@ } [Test] - [TestCase(true, false)] - [TestCase(true, true)] - [TestCase(false, false)] - public void Calculate_VariousFloodedCulvertLinearCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater) + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Calculate_VariousLowSillQuadraticCalculationsWithBreakWater_InputPropertiesCorrectlySentToCalculator(BreakWaterType breakWaterType) { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); @@ -856,14 +978,137 @@ InputParameters = { HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), + InflowModelType = StabilityPointStructureInflowModelType.LowSill, + LoadSchematizationType = LoadSchematizationType.Quadratic, + ForeshoreProfile = new TestForeshoreProfile(true) + { + BreakWater = + { + Type = breakWaterType + } + } + } + }; + + using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) + { + // Call + new StabilityPointStructuresCalculationService().Calculate(calculation, + failureMechanism.GeneralInput, + failureMechanism.GeneralInput.N, + assessmentSection.FailureMechanismContribution.Norm, + failureMechanism.Contribution, + validFilePath, + validPreprocessorDirectory); + + // Assert + StructuresStabilityPointCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); + Assert.AreEqual(1, calculationInputs.Length); + + GeneralStabilityPointStructuresInput generalInput = failureMechanism.GeneralInput; + StabilityPointStructuresInput input = calculation.InputParameters; + var expectedInput = new StructuresStabilityPointLowSillQuadraticCalculationInput( + 1300001, + input.StructureNormalOrientation, + input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), + input.VolumicWeightWater, + generalInput.GravitationalAcceleration, + input.LevelCrestStructure.Mean, + input.LevelCrestStructure.StandardDeviation, + input.StructureNormalOrientation, + input.FactorStormDurationOpenStructure, + generalInput.ModelFactorSubCriticalFlow.Mean, + generalInput.ModelFactorSubCriticalFlow.CoefficientOfVariation, + input.ThresholdHeightOpenWeir.Mean, + input.ThresholdHeightOpenWeir.StandardDeviation, + input.InsideWaterLevelFailureConstruction.Mean, + input.InsideWaterLevelFailureConstruction.StandardDeviation, + input.FailureProbabilityRepairClosure, + input.FailureCollisionEnergy.Mean, + input.FailureCollisionEnergy.CoefficientOfVariation, + generalInput.ModelFactorCollisionLoad.Mean, + generalInput.ModelFactorCollisionLoad.CoefficientOfVariation, + input.ShipMass.Mean, + input.ShipMass.CoefficientOfVariation, + input.ShipVelocity.Mean, + input.ShipVelocity.CoefficientOfVariation, + input.LevellingCount, + input.ProbabilityCollisionSecondaryStructure, + input.FlowVelocityStructureClosable.Mean, + input.FlowVelocityStructureClosable.CoefficientOfVariation, + input.InsideWaterLevel.Mean, + input.InsideWaterLevel.StandardDeviation, + input.AllowedLevelIncreaseStorage.Mean, + input.AllowedLevelIncreaseStorage.StandardDeviation, + generalInput.ModelFactorStorageVolume.Mean, + generalInput.ModelFactorStorageVolume.StandardDeviation, + input.StorageStructureArea.Mean, + input.StorageStructureArea.CoefficientOfVariation, + generalInput.ModelFactorInflowVolume, + input.FlowWidthAtBottomProtection.Mean, + input.FlowWidthAtBottomProtection.StandardDeviation, + input.CriticalOvertoppingDischarge.Mean, + input.CriticalOvertoppingDischarge.CoefficientOfVariation, + input.FailureProbabilityStructureWithErosion, + input.StormDuration.Mean, + input.StormDuration.CoefficientOfVariation, + input.BankWidth.Mean, + input.BankWidth.StandardDeviation, + input.EvaluationLevel, + generalInput.ModelFactorLoadEffect.Mean, + generalInput.ModelFactorLoadEffect.StandardDeviation, + generalInput.WaveRatioMaxHN, + generalInput.WaveRatioMaxHStandardDeviation, + input.VerticalDistance, + generalInput.ModificationFactorWavesSlowlyVaryingPressureComponent, + generalInput.ModificationFactorDynamicOrImpulsivePressureComponent, + input.ModelFactorSuperCriticalFlow.Mean, + input.ModelFactorSuperCriticalFlow.StandardDeviation, + input.ConstructiveStrengthQuadraticLoadModel.Mean, + input.ConstructiveStrengthQuadraticLoadModel.CoefficientOfVariation, + input.StabilityQuadraticLoadModel.Mean, + input.StabilityQuadraticLoadModel.CoefficientOfVariation, + input.WidthFlowApertures.Mean, + input.WidthFlowApertures.StandardDeviation); + + var actualInput = (StructuresStabilityPointLowSillQuadraticCalculationInput) calculationInputs[0]; + HydraRingDataEqualityHelper.AreEqual(expectedInput, actualInput); + Assert.IsFalse(calculator.IsCanceled); + } + mockRepository.VerifyAll(); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Calculate_VariousFloodedCulvertLinearCalculationsWithoutBreakWater_InputPropertiesCorrectlySentToCalculator(bool useForeshore) + { + // Setup + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + + var calculator = new TestStructuresCalculator(); + var calculatorFactory = mockRepository.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath, validPreprocessorDirectory)) + .Return(calculator); + mockRepository.ReplayAll(); + + var calculation = new TestStabilityPointStructuresCalculation + { + InputParameters = + { + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), InflowModelType = StabilityPointStructureInflowModelType.FloodedCulvert, LoadSchematizationType = LoadSchematizationType.Linear } }; if (useForeshore) { - calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(useBreakWater); + calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(); } using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) @@ -887,7 +1132,7 @@ 1300001, input.StructureNormalOrientation, useForeshore ? input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)) : new HydraRingForelandPoint[0], - useBreakWater ? new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height) : null, + null, input.VolumicWeightWater, generalInput.GravitationalAcceleration, input.LevelCrestStructure.Mean, @@ -956,10 +1201,10 @@ } [Test] - [TestCase(true, false)] - [TestCase(true, true)] - [TestCase(false, false)] - public void Calculate_VariousFloodedCulvertQuadraticCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater) + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Calculate_VariousFloodedCulvertLinearCalculationsWithBreakWater_InputPropertiesCorrectlySentToCalculator(BreakWaterType breakWaterType) { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); @@ -979,13 +1224,136 @@ { HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), InflowModelType = StabilityPointStructureInflowModelType.FloodedCulvert, + LoadSchematizationType = LoadSchematizationType.Linear, + ForeshoreProfile = new TestForeshoreProfile(true) + { + BreakWater = + { + Type = breakWaterType + } + } + } + }; + + using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) + { + // Call + new StabilityPointStructuresCalculationService().Calculate(calculation, + failureMechanism.GeneralInput, + failureMechanism.GeneralInput.N, + assessmentSection.FailureMechanismContribution.Norm, + failureMechanism.Contribution, + validFilePath, + validPreprocessorDirectory); + + // Assert + StructuresStabilityPointCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); + Assert.AreEqual(1, calculationInputs.Length); + + GeneralStabilityPointStructuresInput generalInput = failureMechanism.GeneralInput; + StabilityPointStructuresInput input = calculation.InputParameters; + var expectedInput = new StructuresStabilityPointFloodedCulvertLinearCalculationInput( + 1300001, + input.StructureNormalOrientation, + input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), + input.VolumicWeightWater, + generalInput.GravitationalAcceleration, + input.LevelCrestStructure.Mean, + input.LevelCrestStructure.StandardDeviation, + input.StructureNormalOrientation, + input.FactorStormDurationOpenStructure, + generalInput.ModelFactorSubCriticalFlow.Mean, + generalInput.ModelFactorSubCriticalFlow.CoefficientOfVariation, + input.ThresholdHeightOpenWeir.Mean, + input.ThresholdHeightOpenWeir.StandardDeviation, + input.InsideWaterLevelFailureConstruction.Mean, + input.InsideWaterLevelFailureConstruction.StandardDeviation, + input.FailureProbabilityRepairClosure, + input.FailureCollisionEnergy.Mean, + input.FailureCollisionEnergy.CoefficientOfVariation, + generalInput.ModelFactorCollisionLoad.Mean, + generalInput.ModelFactorCollisionLoad.CoefficientOfVariation, + input.ShipMass.Mean, + input.ShipMass.CoefficientOfVariation, + input.ShipVelocity.Mean, + input.ShipVelocity.CoefficientOfVariation, + input.LevellingCount, + input.ProbabilityCollisionSecondaryStructure, + input.FlowVelocityStructureClosable.Mean, + input.FlowVelocityStructureClosable.CoefficientOfVariation, + input.InsideWaterLevel.Mean, + input.InsideWaterLevel.StandardDeviation, + input.AllowedLevelIncreaseStorage.Mean, + input.AllowedLevelIncreaseStorage.StandardDeviation, + generalInput.ModelFactorStorageVolume.Mean, + generalInput.ModelFactorStorageVolume.StandardDeviation, + input.StorageStructureArea.Mean, + input.StorageStructureArea.CoefficientOfVariation, + generalInput.ModelFactorInflowVolume, + input.FlowWidthAtBottomProtection.Mean, + input.FlowWidthAtBottomProtection.StandardDeviation, + input.CriticalOvertoppingDischarge.Mean, + input.CriticalOvertoppingDischarge.CoefficientOfVariation, + input.FailureProbabilityStructureWithErosion, + input.StormDuration.Mean, + input.StormDuration.CoefficientOfVariation, + input.BankWidth.Mean, + input.BankWidth.StandardDeviation, + input.EvaluationLevel, + generalInput.ModelFactorLoadEffect.Mean, + generalInput.ModelFactorLoadEffect.StandardDeviation, + generalInput.WaveRatioMaxHN, + generalInput.WaveRatioMaxHStandardDeviation, + input.VerticalDistance, + generalInput.ModificationFactorWavesSlowlyVaryingPressureComponent, + generalInput.ModificationFactorDynamicOrImpulsivePressureComponent, + input.DrainCoefficient.Mean, + input.DrainCoefficient.StandardDeviation, + input.AreaFlowApertures.Mean, + input.AreaFlowApertures.StandardDeviation, + input.ConstructiveStrengthLinearLoadModel.Mean, + input.ConstructiveStrengthLinearLoadModel.CoefficientOfVariation, + input.StabilityLinearLoadModel.Mean, + input.StabilityLinearLoadModel.CoefficientOfVariation); + + var actualInput = (StructuresStabilityPointFloodedCulvertLinearCalculationInput) calculationInputs[0]; + HydraRingDataEqualityHelper.AreEqual(expectedInput, actualInput); + Assert.IsFalse(calculator.IsCanceled); + } + mockRepository.VerifyAll(); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Calculate_VariousFloodedCulvertQuadraticCalculationsWithoutBreakWater_InputPropertiesCorrectlySentToCalculator(bool useForeshore) + { + // Setup + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + + var calculator = new TestStructuresCalculator(); + var calculatorFactory = mockRepository.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath, validPreprocessorDirectory)) + .Return(calculator); + mockRepository.ReplayAll(); + + var calculation = new TestStabilityPointStructuresCalculation + { + InputParameters = + { + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), + InflowModelType = StabilityPointStructureInflowModelType.FloodedCulvert, LoadSchematizationType = LoadSchematizationType.Quadratic } }; if (useForeshore) { - calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(useBreakWater); + calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(); } using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) @@ -1009,7 +1377,7 @@ 1300001, input.StructureNormalOrientation, useForeshore ? input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)) : new HydraRingForelandPoint[0], - useBreakWater ? new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height) : null, + null, input.VolumicWeightWater, generalInput.GravitationalAcceleration, input.LevelCrestStructure.Mean, @@ -1078,6 +1446,130 @@ } [Test] + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Calculate_VariousFloodedCulvertQuadraticCalculationsWithBreakWater_InputPropertiesCorrectlySentToCalculator(BreakWaterType breakWaterType) + { + // Setup + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + + var mockRepository = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); + + var calculator = new TestStructuresCalculator(); + var calculatorFactory = mockRepository.StrictMock(); + calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath, validPreprocessorDirectory)) + .Return(calculator); + mockRepository.ReplayAll(); + + var calculation = new TestStabilityPointStructuresCalculation + { + InputParameters = + { + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), + InflowModelType = StabilityPointStructureInflowModelType.FloodedCulvert, + LoadSchematizationType = LoadSchematizationType.Quadratic, + ForeshoreProfile = new TestForeshoreProfile(true) + { + BreakWater = + { + Type = breakWaterType + } + } + } + }; + + using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) + { + // Call + new StabilityPointStructuresCalculationService().Calculate(calculation, + failureMechanism.GeneralInput, + failureMechanism.GeneralInput.N, + assessmentSection.FailureMechanismContribution.Norm, + failureMechanism.Contribution, + validFilePath, + validPreprocessorDirectory); + + // Assert + StructuresStabilityPointCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray(); + Assert.AreEqual(1, calculationInputs.Length); + + GeneralStabilityPointStructuresInput generalInput = failureMechanism.GeneralInput; + StabilityPointStructuresInput input = calculation.InputParameters; + var expectedInput = new StructuresStabilityPointFloodedCulvertQuadraticCalculationInput( + 1300001, + input.StructureNormalOrientation, + input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), + input.VolumicWeightWater, + generalInput.GravitationalAcceleration, + input.LevelCrestStructure.Mean, + input.LevelCrestStructure.StandardDeviation, + input.StructureNormalOrientation, + input.FactorStormDurationOpenStructure, + generalInput.ModelFactorSubCriticalFlow.Mean, + generalInput.ModelFactorSubCriticalFlow.CoefficientOfVariation, + input.ThresholdHeightOpenWeir.Mean, + input.ThresholdHeightOpenWeir.StandardDeviation, + input.InsideWaterLevelFailureConstruction.Mean, + input.InsideWaterLevelFailureConstruction.StandardDeviation, + input.FailureProbabilityRepairClosure, + input.FailureCollisionEnergy.Mean, + input.FailureCollisionEnergy.CoefficientOfVariation, + generalInput.ModelFactorCollisionLoad.Mean, + generalInput.ModelFactorCollisionLoad.CoefficientOfVariation, + input.ShipMass.Mean, + input.ShipMass.CoefficientOfVariation, + input.ShipVelocity.Mean, + input.ShipVelocity.CoefficientOfVariation, + input.LevellingCount, + input.ProbabilityCollisionSecondaryStructure, + input.FlowVelocityStructureClosable.Mean, + input.FlowVelocityStructureClosable.CoefficientOfVariation, + input.InsideWaterLevel.Mean, + input.InsideWaterLevel.StandardDeviation, + input.AllowedLevelIncreaseStorage.Mean, + input.AllowedLevelIncreaseStorage.StandardDeviation, + generalInput.ModelFactorStorageVolume.Mean, + generalInput.ModelFactorStorageVolume.StandardDeviation, + input.StorageStructureArea.Mean, + input.StorageStructureArea.CoefficientOfVariation, + generalInput.ModelFactorInflowVolume, + input.FlowWidthAtBottomProtection.Mean, + input.FlowWidthAtBottomProtection.StandardDeviation, + input.CriticalOvertoppingDischarge.Mean, + input.CriticalOvertoppingDischarge.CoefficientOfVariation, + input.FailureProbabilityStructureWithErosion, + input.StormDuration.Mean, + input.StormDuration.CoefficientOfVariation, + input.BankWidth.Mean, + input.BankWidth.StandardDeviation, + input.EvaluationLevel, + generalInput.ModelFactorLoadEffect.Mean, + generalInput.ModelFactorLoadEffect.StandardDeviation, + generalInput.WaveRatioMaxHN, + generalInput.WaveRatioMaxHStandardDeviation, + input.VerticalDistance, + generalInput.ModificationFactorWavesSlowlyVaryingPressureComponent, + generalInput.ModificationFactorDynamicOrImpulsivePressureComponent, + input.DrainCoefficient.Mean, + input.DrainCoefficient.StandardDeviation, + input.AreaFlowApertures.Mean, + input.AreaFlowApertures.StandardDeviation, + input.ConstructiveStrengthQuadraticLoadModel.Mean, + input.ConstructiveStrengthQuadraticLoadModel.CoefficientOfVariation, + input.StabilityQuadraticLoadModel.Mean, + input.StabilityQuadraticLoadModel.CoefficientOfVariation); + + var actualInput = (StructuresStabilityPointFloodedCulvertQuadraticCalculationInput) calculationInputs[0]; + HydraRingDataEqualityHelper.AreEqual(expectedInput, actualInput); + Assert.IsFalse(calculator.IsCanceled); + } + mockRepository.VerifyAll(); + } + + [Test] [Combinatorial] public void Calculate_PreprocessorDirectorySet_InputPropertiesCorrectlySentToCalculator([Values(true, false)] bool usePreprocessor) { Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Integration.Test/StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs =================================================================== diff -u -r571bf6cd20fe3f02f6fe5a51495c3336e226cbbb -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Integration.Test/StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs (.../StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs) (revision 571bf6cd20fe3f02f6fe5a51495c3336e226cbbb) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Integration.Test/StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs (.../StabilityStoneCoverWaveConditionsCalculationActivityIntegrationTest.cs) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -29,6 +29,7 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Service.TestUtil; @@ -195,12 +196,16 @@ } [Test] - public void Run_Always_InputPropertiesCorrectlySendToService() + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Run_Always_InputPropertiesCorrectlySendToService(BreakWaterType breakWaterType) { // Setup const int nrOfCalculators = 6; var mockRepository = new MockRepository(); StabilityStoneCoverWaveConditionsCalculation calculation = GetValidCalculation(); + calculation.InputParameters.BreakWater.Type = breakWaterType; var stabilityStoneCoverFailureMechanism = new StabilityStoneCoverFailureMechanism(); IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(stabilityStoneCoverFailureMechanism, @@ -238,7 +243,7 @@ input.HydraulicBoundaryLocation.Id, assessmentSection.FailureMechanismContribution.Norm, input.ForeshoreProfile.Geometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), - new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), input.WaterLevels.ElementAt(waterLevelIndex++), generalInput.GeneralBlocksWaveConditionsInput.A, generalInput.GeneralBlocksWaveConditionsInput.B, @@ -255,7 +260,7 @@ input.HydraulicBoundaryLocation.Id, assessmentSection.FailureMechanismContribution.Norm, input.ForeshoreProfile.Geometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), - new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), input.WaterLevels.ElementAt(waterLevelIndex++), generalInput.GeneralColumnsWaveConditionsInput.A, generalInput.GeneralColumnsWaveConditionsInput.B, Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Service.Test/StabilityStoneCoverWaveConditionsCalculationServiceTest.cs =================================================================== diff -u -r571bf6cd20fe3f02f6fe5a51495c3336e226cbbb -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Service.Test/StabilityStoneCoverWaveConditionsCalculationServiceTest.cs (.../StabilityStoneCoverWaveConditionsCalculationServiceTest.cs) (revision 571bf6cd20fe3f02f6fe5a51495c3336e226cbbb) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Service.Test/StabilityStoneCoverWaveConditionsCalculationServiceTest.cs (.../StabilityStoneCoverWaveConditionsCalculationServiceTest.cs) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -579,10 +579,15 @@ } [Test] - public void Calculate_Always_InputPropertiesCorrectlySendToCalculator() + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Calculate_Always_InputPropertiesCorrectlySendToCalculator(BreakWaterType breakWaterType) { // Setup StabilityStoneCoverWaveConditionsCalculation calculation = GetValidCalculation(); + calculation.InputParameters.BreakWater.Type = breakWaterType; + var stabilityStoneCoverFailureMechanism = new StabilityStoneCoverFailureMechanism(); var calculator = new TestWaveConditionsCosineCalculator(); @@ -618,7 +623,7 @@ input.HydraulicBoundaryLocation.Id, assessmentSection.FailureMechanismContribution.Norm, input.ForeshoreProfile.Geometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), - new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), input.WaterLevels.ElementAt(waterLevelIndex++), generalInput.GeneralBlocksWaveConditionsInput.A, generalInput.GeneralBlocksWaveConditionsInput.B, @@ -635,7 +640,7 @@ input.HydraulicBoundaryLocation.Id, assessmentSection.FailureMechanismContribution.Norm, input.ForeshoreProfile.Geometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), - new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), input.WaterLevels.ElementAt(waterLevelIndex++), generalInput.GeneralColumnsWaveConditionsInput.A, generalInput.GeneralColumnsWaveConditionsInput.B, Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Integration.Test/WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs =================================================================== diff -u -r409352706e7ed14c76bb43304d262fa22d148160 -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Integration.Test/WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs) (revision 409352706e7ed14c76bb43304d262fa22d148160) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Integration.Test/WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -29,6 +29,7 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.IO.FileImporters; @@ -215,13 +216,17 @@ } [Test] - public void Run_Always_InputPropertiesCorrectlySendToService() + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Run_Always_InputPropertiesCorrectlySendToService(BreakWaterType breakWaterType) { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); ImportHydraulicBoundaryDatabase(assessmentSection); WaveImpactAsphaltCoverWaveConditionsCalculation calculation = GetValidCalculation(assessmentSection); + calculation.InputParameters.BreakWater.Type = breakWaterType; var activity = new WaveImpactAsphaltCoverWaveConditionsCalculationActivity(calculation, validFilePath, @@ -259,7 +264,7 @@ input.HydraulicBoundaryLocation.Id, assessmentSection.FailureMechanismContribution.Norm, input.ForeshoreProfile.Geometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), - new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), calculation.InputParameters.WaterLevels.ElementAt(waterLevelIndex++), generalInput.A, generalInput.B, Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Service.Test/WaveImpactAsphaltCoverWaveConditionsCalculationServiceTest.cs =================================================================== diff -u -r381345fcad26d313d3cfd5ccd3d1e131c1d5c379 -rf2e34a4fdcdf1933f996404af878a57b04a28ebb --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Service.Test/WaveImpactAsphaltCoverWaveConditionsCalculationServiceTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationServiceTest.cs) (revision 381345fcad26d313d3cfd5ccd3d1e131c1d5c379) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Service.Test/WaveImpactAsphaltCoverWaveConditionsCalculationServiceTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationServiceTest.cs) (revision f2e34a4fdcdf1933f996404af878a57b04a28ebb) @@ -519,10 +519,15 @@ } [Test] - public void Calculate_Always_InputPropertiesCorrectlySendToCalculator() + [TestCase(BreakWaterType.Caisson)] + [TestCase(BreakWaterType.Wall)] + [TestCase(BreakWaterType.Dam)] + public void Calculate_Always_InputPropertiesCorrectlySendToCalculator(BreakWaterType breakWaterType) { // Setup WaveImpactAsphaltCoverWaveConditionsCalculation calculation = GetValidCalculation(); + calculation.InputParameters.BreakWater.Type = breakWaterType; + var waveImpactAsphaltCoverFailureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); var calculator = new TestWaveConditionsCosineCalculator(); @@ -557,7 +562,7 @@ input.HydraulicBoundaryLocation.Id, assessmentSection.FailureMechanismContribution.Norm, input.ForeshoreProfile.Geometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), - new HydraRingBreakWater((int) input.BreakWater.Type, input.BreakWater.Height), + new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), calculation.InputParameters.WaterLevels.ElementAt(waterLevelIndex++), generalInput.A, generalInput.B,