Index: Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs =================================================================== diff -u -rb2b9fdf365e70928a05c57966eeed30d9050e528 -r868ce235350ca4bdfecd80eb8469485dc3a1b50d --- Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs (.../HydraulicBoundaryLocationCalculationGuiService.cs) (revision b2b9fdf365e70928a05c57966eeed30d9050e528) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs (.../HydraulicBoundaryLocationCalculationGuiService.cs) (revision 868ce235350ca4bdfecd80eb8469485dc3a1b50d) @@ -57,9 +57,10 @@ this.viewParent = viewParent; } - public bool CalculateDesignWaterLevels(string hydraulicBoundaryDatabasePath, + public bool CalculateDesignWaterLevels(string hydraulicBoundaryDatabaseFilePath, IEnumerable locations, - string ringId, double norm, + string ringId, + double norm, ICalculationMessageProvider messageProvider) { if (messageProvider == null) @@ -71,16 +72,19 @@ { throw new ArgumentNullException(nameof(locations)); } - var activities = locations.Select(location => new DesignWaterLevelCalculationActivity(location, - hydraulicBoundaryDatabasePath, - ringId, - norm, messageProvider)).ToArray(); - return RunActivities(hydraulicBoundaryDatabasePath, activities); + + return RunActivities(hydraulicBoundaryDatabaseFilePath, + locations.Select(location => new DesignWaterLevelCalculationActivity(location, + hydraulicBoundaryDatabaseFilePath, + ringId, + norm, + messageProvider)).ToArray()); } - public bool CalculateWaveHeights(string hydraulicBoundaryDatabasePath, + public bool CalculateWaveHeights(string hydraulicBoundaryDatabaseFilePath, IEnumerable locations, - string ringId, double norm, + string ringId, + double norm, ICalculationMessageProvider messageProvider) { if (messageProvider == null) @@ -92,11 +96,13 @@ { throw new ArgumentNullException(nameof(locations)); } - var activities = locations.Select(location => new WaveHeightCalculationActivity(location, - hydraulicBoundaryDatabasePath, - ringId, - norm, messageProvider)).ToArray(); - return RunActivities(hydraulicBoundaryDatabasePath, activities); + + return RunActivities(hydraulicBoundaryDatabaseFilePath, + locations.Select(location => new WaveHeightCalculationActivity(location, + hydraulicBoundaryDatabaseFilePath, + ringId, + norm, + messageProvider)).ToArray()); } private bool RunActivities(string hydraulicBoundaryDatabasePath, IList activities) where TActivity : Activity Index: Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/IHydraulicBoundaryLocationCalculationGuiService.cs =================================================================== diff -u -re182f6f394aa75e739467a77e7bcacd9a8b25429 -r868ce235350ca4bdfecd80eb8469485dc3a1b50d --- Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/IHydraulicBoundaryLocationCalculationGuiService.cs (.../IHydraulicBoundaryLocationCalculationGuiService.cs) (revision e182f6f394aa75e739467a77e7bcacd9a8b25429) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/IHydraulicBoundaryLocationCalculationGuiService.cs (.../IHydraulicBoundaryLocationCalculationGuiService.cs) (revision 868ce235350ca4bdfecd80eb8469485dc3a1b50d) @@ -35,7 +35,7 @@ /// /// Performs the calculation for all . /// - /// The path to the hydraulic boundaries database. + /// The HLCD file that should be used for performing the calculation. /// The objects to calculate /// the for. /// The id of the ring to perform the calculation for. @@ -44,7 +44,7 @@ /// True if the observers should be notified; false if otherwise /// Thrown when /// or is null. - bool CalculateDesignWaterLevels(string hydraulicBoundaryDatabasePath, + bool CalculateDesignWaterLevels(string hydraulicBoundaryDatabaseFilePath, IEnumerable locations, string ringId, double norm, @@ -53,7 +53,7 @@ /// /// Performs the calculation for all . /// - /// The path to the hydraulic boundaries database. + /// The HLCD file that should be used for performing the calculation. /// The objects to calculate /// the for. /// The id of the ring to perform the calculation for. @@ -62,7 +62,7 @@ /// True if the observers should be notified; false if otherwise /// Thrown when /// or is null. - bool CalculateWaveHeights(string hydraulicBoundaryDatabasePath, + bool CalculateWaveHeights(string hydraulicBoundaryDatabaseFilePath, IEnumerable locations, string ringId, double norm, Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/GuiServices/DuneLocationCalculationGuiService.cs =================================================================== diff -u -r4d7de1f1614ff778fca061558d2912ff752570fc -r868ce235350ca4bdfecd80eb8469485dc3a1b50d --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/GuiServices/DuneLocationCalculationGuiService.cs (.../DuneLocationCalculationGuiService.cs) (revision 4d7de1f1614ff778fca061558d2912ff752570fc) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/GuiServices/DuneLocationCalculationGuiService.cs (.../DuneLocationCalculationGuiService.cs) (revision 868ce235350ca4bdfecd80eb8469485dc3a1b50d) @@ -24,7 +24,6 @@ using System.Linq; using System.Windows.Forms; using Core.Common.Gui.Forms.ProgressDialog; -using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.DuneErosion.Data; using Ringtoets.DuneErosion.Service; @@ -57,12 +56,15 @@ /// The objects to perform the calculation for. /// The /// that holds information about the contribution and the general inputs used in the calculation. - /// The that hold information about - /// the norm used in the calculation. + /// The HLCD file that should be used for performing the calculation. + /// The id of the ring to perform the calculation for. + /// The norm to use during the calculation. /// Thrown when any parameter is null. public void Calculate(IEnumerable locations, DuneErosionFailureMechanism failureMechanism, - IAssessmentSection assessmentSection) + string hydraulicBoundaryDatabaseFilePath, + string ringId, + double norm) { if (locations == null) { @@ -72,17 +74,13 @@ { throw new ArgumentNullException(nameof(failureMechanism)); } - if (assessmentSection == null) - { - throw new ArgumentNullException(nameof(assessmentSection)); - } ActivityProgressDialogRunner.Run(viewParent, locations .Select(l => new DuneErosionBoundaryCalculationActivity(l, failureMechanism, - assessmentSection.HydraulicBoundaryDatabase.FilePath, - assessmentSection.Id, - assessmentSection.FailureMechanismContribution.Norm)).ToArray()); + hydraulicBoundaryDatabaseFilePath, + ringId, + norm)).ToArray()); } } } \ No newline at end of file Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsView.cs =================================================================== diff -u -r888f6cdc81e8fb6d6a5b9baadf6395f209008836 -r868ce235350ca4bdfecd80eb8469485dc3a1b50d --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsView.cs (.../DuneLocationsView.cs) (revision 888f6cdc81e8fb6d6a5b9baadf6395f209008836) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsView.cs (.../DuneLocationsView.cs) (revision 868ce235350ca4bdfecd80eb8469485dc3a1b50d) @@ -139,7 +139,9 @@ { CalculationGuiService.Calculate(locationsToCalculate, FailureMechanism, - AssessmentSection); + AssessmentSection.HydraulicBoundaryDatabase.FilePath, + AssessmentSection.Id, + AssessmentSection.FailureMechanismContribution.Norm); ((IObservable) Data).NotifyObservers(); } Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs =================================================================== diff -u -r90fb0bee68ae22094e4ef328dc563985f63365fe -r868ce235350ca4bdfecd80eb8469485dc3a1b50d --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs (.../DuneErosionPlugin.cs) (revision 90fb0bee68ae22094e4ef328dc563985f63365fe) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs (.../DuneErosionPlugin.cs) (revision 868ce235350ca4bdfecd80eb8469485dc3a1b50d) @@ -258,7 +258,9 @@ duneLocationCalculationGuiService.Calculate(context.WrappedData, context.FailureMechanism, - context.AssessmentSection); + context.AssessmentSection.HydraulicBoundaryDatabase.FilePath, + context.AssessmentSection.Id, + context.AssessmentSection.FailureMechanismContribution.Norm); context.NotifyObservers(); }) { Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/GuiServices/DuneLocationCalculationGuiServiceTest.cs =================================================================== diff -u -r90fb0bee68ae22094e4ef328dc563985f63365fe -r868ce235350ca4bdfecd80eb8469485dc3a1b50d --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/GuiServices/DuneLocationCalculationGuiServiceTest.cs (.../DuneLocationCalculationGuiServiceTest.cs) (revision 90fb0bee68ae22094e4ef328dc563985f63365fe) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/GuiServices/DuneLocationCalculationGuiServiceTest.cs (.../DuneLocationCalculationGuiServiceTest.cs) (revision 868ce235350ca4bdfecd80eb8469485dc3a1b50d) @@ -26,10 +26,6 @@ using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Framework; -using Rhino.Mocks; -using Ringtoets.Common.Data.AssessmentSection; -using Ringtoets.Common.Data.Contribution; -using Ringtoets.Common.Data.Hydraulics; using Ringtoets.DuneErosion.Data; using Ringtoets.DuneErosion.Forms.GuiServices; using Ringtoets.HydraRing.Calculation.TestUtil.Calculator; @@ -56,68 +52,47 @@ public void Calculate_LocationsNull_ThrowArgumentNullException() { // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - var failureMechanism = new DuneErosionFailureMechanism(); using (var viewParent = new Form()) { var guiService = new DuneLocationCalculationGuiService(viewParent); // Call - TestDelegate test = () => guiService.Calculate(null, failureMechanism, assessmentSection); + TestDelegate test = () => guiService.Calculate(null, + failureMechanism, + "path", + "id", + 1.0 / 30000); // Assert var exception = Assert.Throws(test); Assert.AreEqual("locations", exception.ParamName); } - mocks.VerifyAll(); } [Test] public void Calculate_FailureMechanismNull_ThrowArgumentNullException() { // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - using (var viewParent = new Form()) { var guiService = new DuneLocationCalculationGuiService(viewParent); // Call - TestDelegate test = () => guiService.Calculate(Enumerable.Empty(), null, assessmentSection); + TestDelegate test = () => guiService.Calculate(Enumerable.Empty(), + null, + "path", + "id", + 1.0 / 30000); // Assert var exception = Assert.Throws(test); Assert.AreEqual("failureMechanism", exception.ParamName); } - mocks.VerifyAll(); } [Test] - public void Calculate_AssessmentSectionNull_ThrowArgumentNullException() - { - // Setup - var failureMechanism = new DuneErosionFailureMechanism(); - - using (var viewParent = new Form()) - { - var guiService = new DuneLocationCalculationGuiService(viewParent); - - // Call - TestDelegate test = () => guiService.Calculate(Enumerable.Empty(), failureMechanism, null); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("assessmentSection", exception.ParamName); - } - } - - [Test] public void Calculate_ValidData_ScheduleAllLocations() { // Setup @@ -145,27 +120,6 @@ }) }); - var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - { - FilePath = validFilePath - }; - - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; - assessmentSection.Stub(a => a.Id).Return("13-1"); - assessmentSection.Stub(a => a.GetFailureMechanisms()).Return(new[] - { - failureMechanism - }); - assessmentSection.Stub(a => a.FailureMechanismContribution) - .Return(new FailureMechanismContribution(new[] - { - failureMechanism - }, 1, 1.0/200)); - - mocks.ReplayAll(); - using (var viewParent = new Form()) using (new HydraRingCalculatorFactoryConfig()) { @@ -174,7 +128,9 @@ // Call TestHelper.AssertLogMessages(() => guiService.Calculate(failureMechanism.DuneLocations, failureMechanism, - assessmentSection), + validFilePath, + "13-1", + 1.0 / 200), messages => { var messageList = messages.ToList();