Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Service.Test/WaveConditionsCalculationServiceBaseTest.cs =================================================================== diff -u -r7371a70ed0751d341d41a7b951b780d286f83791 -rd0cb30af53aae72f06d11ad4a5bf3d96fd025521 --- Ringtoets/Revetment/test/Ringtoets.Revetment.Service.Test/WaveConditionsCalculationServiceBaseTest.cs (.../WaveConditionsCalculationServiceBaseTest.cs) (revision 7371a70ed0751d341d41a7b951b780d286f83791) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.Service.Test/WaveConditionsCalculationServiceBaseTest.cs (.../WaveConditionsCalculationServiceBaseTest.cs) (revision d0cb30af53aae72f06d11ad4a5bf3d96fd025521) @@ -413,9 +413,8 @@ [Test] [Combinatorial] - public void Calculate_Always_StartsCalculationWithRightParameters( - [Values(true, false)] bool useForeshore, - [Values(true, false)] bool useBreakWater) + public void Calculate_WithoutBreakWater_StartsCalculationWithRightParameters( + [Values(true, false)] bool useForeshore) { // Setup var waterLevel = (RoundedDouble) 4.20; @@ -430,7 +429,7 @@ UpperBoundaryRevetment = (RoundedDouble) 4, LowerBoundaryRevetment = (RoundedDouble) 3, StepSize = WaveConditionsInputStepSize.Two, - UseBreakWater = useBreakWater, + UseBreakWater = false, UseForeshore = useForeshore, Orientation = (RoundedDouble) 0 }; @@ -456,14 +455,71 @@ // 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] + [Combinatorial] + public void Calculate_WithBreakWater_StartsCalculationWithRightParameters( + [Values(BreakWaterType.Caisson, + BreakWaterType.Wall, + BreakWaterType.Dam)] 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)) + .Return(calculator) + .Repeat + .Times(nrOfCalculators); + mockRepository.ReplayAll(); + + using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) + { + // Call + new WaveConditionsCalculationService().PublicCalculate(a, b, c, norm, input, hcldFilePath); + + // 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] [TestCaseSource(typeof(HydraRingCalculatorTestCaseProvider), nameof(HydraRingCalculatorTestCaseProvider.GetCalculatorFailingConditionsWithReportDetails), new object[] { nameof(Calculate_ThreeCalculationsFail_ThrowsHydraRingCalculationExceptionAndLogError) @@ -698,7 +754,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,