Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -r6b9fda141298524c0910937dd090d82be420c52b -r6ddf92411860d3f692da3018e1662e633003e0a9 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 6b9fda141298524c0910937dd090d82be420c52b) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 6ddf92411860d3f692da3018e1662e633003e0a9) @@ -206,10 +206,6 @@ {87C2C553-C0BC-40BF-B1EA-B83BFF357F27} Ringtoets.Revetment.Data - - {AF1ACFA2-AEE5-4DB7-98CA-8B3720E46AD9} - Ringtoets.Revetment.Forms - {E3347B16-BB18-41C1-8D34-FBCBF20DB695} Ringtoets.Revetment.IO Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelLocationsContextTreeNodeInfoTest.cs =================================================================== diff -u -r02670d8c9fceeaea5f829937a2eb269f3488c6b1 -r6ddf92411860d3f692da3018e1662e633003e0a9 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelLocationsContextTreeNodeInfoTest.cs (.../DesignWaterLevelLocationsContextTreeNodeInfoTest.cs) (revision 02670d8c9fceeaea5f829937a2eb269f3488c6b1) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelLocationsContextTreeNodeInfoTest.cs (.../DesignWaterLevelLocationsContextTreeNodeInfoTest.cs) (revision 6ddf92411860d3f692da3018e1662e633003e0a9) @@ -37,15 +37,12 @@ using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.TestUtil; -using Ringtoets.Common.Service; using Ringtoets.HydraRing.Calculation.Calculator.Factory; -using Ringtoets.HydraRing.Calculation.TestUtil; using Ringtoets.HydraRing.Calculation.TestUtil.Calculator; using Ringtoets.HydraRing.Data; using Ringtoets.Integration.Data; using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Plugin; -using Ringtoets.Integration.Service.MessageProviders; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; namespace Ringtoets.Integration.Forms.Test.TreeNodeInfos Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightLocationsContextTreeNodeInfoTest.cs =================================================================== diff -u -r02670d8c9fceeaea5f829937a2eb269f3488c6b1 -r6ddf92411860d3f692da3018e1662e633003e0a9 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightLocationsContextTreeNodeInfoTest.cs (.../WaveHeightLocationsContextTreeNodeInfoTest.cs) (revision 02670d8c9fceeaea5f829937a2eb269f3488c6b1) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightLocationsContextTreeNodeInfoTest.cs (.../WaveHeightLocationsContextTreeNodeInfoTest.cs) (revision 6ddf92411860d3f692da3018e1662e633003e0a9) @@ -38,7 +38,6 @@ using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.TestUtil; using Ringtoets.HydraRing.Calculation.Calculator.Factory; -using Ringtoets.HydraRing.Calculation.TestUtil; using Ringtoets.HydraRing.Calculation.TestUtil.Calculator; using Ringtoets.HydraRing.Data; using Ringtoets.Integration.Data; Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationServiceBase.cs =================================================================== diff -u -r876e8dad04c55d7c515f485312be8c3acf899740 -r6ddf92411860d3f692da3018e1662e633003e0a9 --- Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationServiceBase.cs (.../WaveConditionsCalculationServiceBase.cs) (revision 876e8dad04c55d7c515f485312be8c3acf899740) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Service/WaveConditionsCalculationServiceBase.cs (.../WaveConditionsCalculationServiceBase.cs) (revision 6ddf92411860d3f692da3018e1662e633003e0a9) @@ -52,6 +52,9 @@ private int currentStep = 1; private IWaveConditionsCosineCalculator calculator; + /// + /// Cancels any currently running wave conditions calculation. + /// public void Cancel() { if (calculator != null) @@ -61,18 +64,34 @@ Canceled = true; } - protected bool Canceled { get; set; } + /// + /// Gets whether the calculation is canceled or not. + /// + protected bool Canceled { get; private set; } - protected static bool ValidateWaveConditionsInput(WaveConditionsInput waveConditionsInput, string name, string hydraulicBoundaryDatabaseFilePath, string calculatedValueName) + /// + /// Performs validation over the values on the given . + /// Error and status information is logged during the execution of the operation. + /// + /// The input of the calculation. + /// The name of the calculation. + /// The directory of the HLCD file that should be used for performing the calculation. + /// The name of the design water level property. + /// Truec> if has no validation errors; Falsec> otherwise. + /// Thrown when is null. + protected static bool ValidateWaveConditionsInput(WaveConditionsInput waveConditionsInput, + string name, + string hydraulicBoundaryDatabaseFilePath, + string designWaterLevelName) { - if (calculatedValueName == null) + if (designWaterLevelName == null) { - throw new ArgumentNullException("calculatedValueName"); + throw new ArgumentNullException("designWaterLevelName"); } CalculationServiceHelper.LogValidationBeginTime(name); - string[] messages = ValidateInput(hydraulicBoundaryDatabaseFilePath, waveConditionsInput, calculatedValueName); + string[] messages = ValidateInput(hydraulicBoundaryDatabaseFilePath, waveConditionsInput, designWaterLevelName); CalculationServiceHelper.LogMessagesAsError(RingtoetsCommonServiceResources.Error_in_validation_0, messages); @@ -81,21 +100,36 @@ return !messages.Any(); } - protected IEnumerable CalculateWaveConditions(string calculationName, WaveConditionsInput waveConditionsInput, RoundedDouble a, RoundedDouble b, RoundedDouble c, double norm, string ringId, string hlcdFilePath) + /// + /// Performs a wave conditoins calculation based on the supplied and returns the output. + /// Error and status information is logged during the execution of the operation. + /// + /// The name of the calculation. + /// The that holds all the information required to perform the calculation. + /// The 'a' factor decided on failure mechanism level. + /// The 'b' factor decided on failure mechanism level. + /// The 'c' factor decided on failure mechanism level. + /// The norm to use as the target. + /// The id of the assessment section for which calculations are performed. + /// The directory of the hydraulic boundary database. + /// An of . + protected IEnumerable CalculateWaveConditions(string calculationName, + WaveConditionsInput waveConditionsInput, + RoundedDouble a, + RoundedDouble b, + RoundedDouble c, + double norm, + string ringId, + string hlcdFilePath) { var outputs = new List(); var waterLevels = waveConditionsInput.WaterLevels.ToArray(); - foreach (var waterLevel in waterLevels) + foreach (var waterLevel in waterLevels.TakeWhile(waterLevel => !Canceled)) { - if (Canceled) - { - break; - } - log.Info(string.Format(Resources.WaveConditionsCalculationService_OnRun_Subject_0_for_waterlevel_1_started, - calculationName, - waterLevel)); + calculationName, + waterLevel)); NotifyProgress(waterLevel, currentStep++, TotalWaterLevelCalculations); @@ -115,33 +149,33 @@ } log.Info(string.Format(Resources.WaveConditionsCalculationService_OnRun_Subject_0_for_waterlevel_1_ended, - calculationName, - waterLevel)); + calculationName, + waterLevel)); } return outputs; } - protected static string[] ValidateInput(string hydraulicBoundaryDatabaseFilePath, + private static string[] ValidateInput(string hydraulicBoundaryDatabaseFilePath, WaveConditionsInput input, - string calculatedValueName) + string designWaterLevelName) { - List validationResult = new List(); + var validationResults = new List(); string validationProblem = HydraulicDatabaseHelper.ValidatePathForCalculation(hydraulicBoundaryDatabaseFilePath); if (!string.IsNullOrEmpty(validationProblem)) { - validationResult.Add(validationProblem); + validationResults.Add(validationProblem); } else { - string message = ValidateWaveConditionsInput(input, calculatedValueName); + string message = ValidateWaveConditionsInput(input, designWaterLevelName); if (!string.IsNullOrEmpty(message)) { - validationResult.Add(message); + validationResults.Add(message); } } - return validationResult.ToArray(); + return validationResults.ToArray(); } private void NotifyProgress(RoundedDouble waterLevel, int currentStepNumber, int totalStepsNumber) @@ -166,7 +200,15 @@ /// The id of the assessment section for which calculations are performed. /// The name used for logging. /// A if the calcultion was succesful; or null if it was canceled. - private WaveConditionsOutput CalculateWaterLevel(RoundedDouble waterLevel, double a, double b, double c, double norm, WaveConditionsInput input, string hlcdDirectory, string ringId, string name) + private WaveConditionsOutput CalculateWaterLevel(RoundedDouble waterLevel, + RoundedDouble a, + RoundedDouble b, + RoundedDouble c, + double norm, + WaveConditionsInput input, + string hlcdDirectory, + string ringId, + string name) { calculator = HydraRingCalculatorFactory.Instance.CreateWaveConditionsCosineCalculator(hlcdDirectory, ringId); WaveConditionsCosineCalculationInput calculationInput = CreateInput(waterLevel, a, b, c, norm, input); @@ -184,17 +226,20 @@ { if (!Canceled) { - log.ErrorFormat(CultureInfo.CurrentCulture, Resources.WaveConditionsCalculationService_VerifyWaveConditionsCalculationOutput_Error_in_wave_conditions_calculation_0_for_waterlevel_1, name, waterLevel); + log.ErrorFormat(CultureInfo.CurrentCulture, + Resources.WaveConditionsCalculationService_VerifyWaveConditionsCalculationOutput_Error_in_wave_conditions_calculation_0_for_waterlevel_1, + name, + waterLevel); throw; } return null; } } - private static WaveConditionsCosineCalculationInput CreateInput(double waterLevel, - double a, - double b, - double c, + private static WaveConditionsCosineCalculationInput CreateInput(RoundedDouble waterLevel, + RoundedDouble a, + RoundedDouble b, + RoundedDouble c, double norm, WaveConditionsInput input) { Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Service.Test/Ringtoets.Revetment.Service.Test.csproj =================================================================== diff -u -r02670d8c9fceeaea5f829937a2eb269f3488c6b1 -r6ddf92411860d3f692da3018e1662e633003e0a9 --- Ringtoets/Revetment/test/Ringtoets.Revetment.Service.Test/Ringtoets.Revetment.Service.Test.csproj (.../Ringtoets.Revetment.Service.Test.csproj) (revision 02670d8c9fceeaea5f829937a2eb269f3488c6b1) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.Service.Test/Ringtoets.Revetment.Service.Test.csproj (.../Ringtoets.Revetment.Service.Test.csproj) (revision 6ddf92411860d3f692da3018e1662e633003e0a9) @@ -86,10 +86,6 @@ {74CBA865-9338-447F-BAD9-28312446AE84} Ringtoets.HydraRing.Calculation.TestUtil - - {9E4A7C0B-F8B5-4101-B9D5-90F3F3C0FF7C} - Ringtoets.WaveImpactAsphaltCover.Service - {87C2C553-C0BC-40BF-B1EA-B83BFF357F27} Ringtoets.Revetment.Data Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Service.Test/WaveConditionsCalculationServiceBaseTest.cs =================================================================== diff -u -r02670d8c9fceeaea5f829937a2eb269f3488c6b1 -r6ddf92411860d3f692da3018e1662e633003e0a9 --- Ringtoets/Revetment/test/Ringtoets.Revetment.Service.Test/WaveConditionsCalculationServiceBaseTest.cs (.../WaveConditionsCalculationServiceBaseTest.cs) (revision 02670d8c9fceeaea5f829937a2eb269f3488c6b1) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.Service.Test/WaveConditionsCalculationServiceBaseTest.cs (.../WaveConditionsCalculationServiceBaseTest.cs) (revision 6ddf92411860d3f692da3018e1662e633003e0a9) @@ -64,7 +64,7 @@ // Assert var exception = Assert.Throws(action); - Assert.AreEqual("calculatedValueName", exception.ParamName); + Assert.AreEqual("designWaterLevelName", exception.ParamName); } [Test]