Index: Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs =================================================================== diff -u -r8ba742d2139563c9571e32f074c7c4b3077f45ee -ra5cd9b063d07cb1205e7691b7ff38fc393005210 --- Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs (.../DesignWaterLevelCalculationService.cs) (revision 8ba742d2139563c9571e32f074c7c4b3077f45ee) +++ Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationService.cs (.../DesignWaterLevelCalculationService.cs) (revision a5cd9b063d07cb1205e7691b7ff38fc393005210) @@ -90,7 +90,7 @@ /// Unable to open settings database file. /// Unable to read required data from database file. /// - /// Thrown when an error occurs while performing the calculation. + /// Thrown when an error occurs while performing the calculation. public void Calculate(IDesignWaterLevelCalculation designWaterLevelCalculation, string hydraulicBoundaryDatabaseFilePath, double norm, @@ -110,32 +110,10 @@ try { - AssessmentLevelCalculationInput calculationInput = CreateInput(designWaterLevelCalculation, norm, hydraulicBoundaryDatabaseFilePath); - - bool calculateIllustrationPoints = designWaterLevelCalculation.CalculateIllustrationPoints; - if (calculateIllustrationPoints) - { - calculator.CalculateWithIllustrationPoints(calculationInput); - } - else - { - calculator.Calculate(calculationInput); - } - - if (canceled || !string.IsNullOrEmpty(calculator.LastErrorFileContent)) - { - return; - } - - HydraulicBoundaryLocationOutput hydraulicBoundaryLocationOutput = CreateHydraulicBoundaryLocationOutput( - messageProvider, designWaterLevelCalculation.Name, calculationInput.Beta, norm, calculator.Converged); - - if (calculateIllustrationPoints) - { - SetIllustrationPointsResult(hydraulicBoundaryLocationOutput, calculator.IllustrationPointsResult); - } - - designWaterLevelCalculation.Output = hydraulicBoundaryLocationOutput; + PerformCalculation(designWaterLevelCalculation, + hydraulicBoundaryDatabaseFilePath, + norm, + messageProvider); } catch (HydraRingCalculationException e) { @@ -179,6 +157,54 @@ canceled = true; } + /// + /// Performs a calculation for the design water level. + /// + /// The design water level calculation to use. + /// The path which points to the hydraulic boundary database file. + /// The norm of the assessment section. + /// The object which is used to build log messages. + /// Thrown when: + /// + /// No settings database file could be found at the location of + /// with the same name. + /// Unable to open settings database file. + /// Unable to read required data from database file. + /// + /// Thrown when an error occurs while performing the calculation. + private void PerformCalculation(IDesignWaterLevelCalculation designWaterLevelCalculation, + string hydraulicBoundaryDatabaseFilePath, + double norm, + ICalculationMessageProvider messageProvider) + { + AssessmentLevelCalculationInput calculationInput = CreateInput(designWaterLevelCalculation, norm, hydraulicBoundaryDatabaseFilePath); + + bool calculateIllustrationPoints = designWaterLevelCalculation.CalculateIllustrationPoints; + if (calculateIllustrationPoints) + { + calculator.CalculateWithIllustrationPoints(calculationInput); + } + else + { + calculator.Calculate(calculationInput); + } + + if (canceled || !string.IsNullOrEmpty(calculator.LastErrorFileContent)) + { + return; + } + + HydraulicBoundaryLocationOutput hydraulicBoundaryLocationOutput = CreateHydraulicBoundaryLocationOutput( + messageProvider, designWaterLevelCalculation.Name, calculationInput.Beta, norm, calculator.Converged); + + if (calculateIllustrationPoints) + { + SetIllustrationPointsResult(hydraulicBoundaryLocationOutput, calculator.IllustrationPointsResult); + } + + designWaterLevelCalculation.Output = hydraulicBoundaryLocationOutput; + } + private static void SetIllustrationPointsResult(HydraulicBoundaryLocationOutput hydraulicBoundaryLocationOutput, HydraGeneralResult hydraGeneralResult) { Index: Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj =================================================================== diff -u -r8ba742d2139563c9571e32f074c7c4b3077f45ee -ra5cd9b063d07cb1205e7691b7ff38fc393005210 --- Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision 8ba742d2139563c9571e32f074c7c4b3077f45ee) +++ Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision a5cd9b063d07cb1205e7691b7ff38fc393005210) @@ -123,7 +123,6 @@ Designer -