Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/GuiServices/DuneLocationCalculationGuiService.cs =================================================================== diff -u -r63a5a07d2178d1a83e2439cb40bcfd8cae317455 -rf0d6c65c6d7251bdc0c2cde6128d5777cff9ed49 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/GuiServices/DuneLocationCalculationGuiService.cs (.../DuneLocationCalculationGuiService.cs) (revision 63a5a07d2178d1a83e2439cb40bcfd8cae317455) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/GuiServices/DuneLocationCalculationGuiService.cs (.../DuneLocationCalculationGuiService.cs) (revision f0d6c65c6d7251bdc0c2cde6128d5777cff9ed49) @@ -56,35 +56,27 @@ } /// - /// Performs the calculation for all . + /// Performs the calculation for all . /// - /// The objects to perform the calculation for. - /// for obtaining a - /// based on . + /// The collection of to perform + /// the calculation for. /// The hydraulic boundary database file /// that should be used for performing the calculation. /// The preprocessor directory. /// The norm to use during the calculation. /// Preprocessing is disabled when /// equals . - /// Thrown when or - /// is null. - public void Calculate(IEnumerable locations, - Func getCalculationFunc, + /// Thrown when is null. + public void Calculate(IEnumerable calculations, string hydraulicBoundaryDatabaseFilePath, string preprocessorDirectory, double norm) { - if (locations == null) + if (calculations == null) { - throw new ArgumentNullException(nameof(locations)); + throw new ArgumentNullException(nameof(calculations)); } - if (getCalculationFunc == null) - { - throw new ArgumentNullException(nameof(getCalculationFunc)); - } - string validationProblem = HydraulicBoundaryDatabaseHelper.ValidateFilesForCalculation(hydraulicBoundaryDatabaseFilePath, preprocessorDirectory); if (!string.IsNullOrEmpty(validationProblem)) @@ -96,11 +88,10 @@ ActivityProgressDialogRunner.Run( viewParent, - locations.Select(l => new DuneErosionBoundaryCalculationActivity(l, - getCalculationFunc(l), - hydraulicBoundaryDatabaseFilePath, - preprocessorDirectory, - norm)).ToArray()); + calculations.Select(calculation => new DuneErosionBoundaryCalculationActivity(calculation, + hydraulicBoundaryDatabaseFilePath, + preprocessorDirectory, + norm)).ToArray()); } } } \ No newline at end of file Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs =================================================================== diff -u -r18e853179b2a70e1404a89b4db662d071c7bfec8 -rf0d6c65c6d7251bdc0c2cde6128d5777cff9ed49 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs (.../DuneErosionPlugin.cs) (revision 18e853179b2a70e1404a89b4db662d071c7bfec8) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs (.../DuneErosionPlugin.cs) (revision f0d6c65c6d7251bdc0c2cde6128d5777cff9ed49) @@ -276,7 +276,6 @@ } duneLocationCalculationGuiService.Calculate(context.WrappedData, - dl => dl.Calculation, context.AssessmentSection.HydraulicBoundaryDatabase.FilePath, context.AssessmentSection.HydraulicBoundaryDatabase.EffectivePreprocessorDirectory(), context.FailureMechanism.GetMechanismSpecificNorm(context.AssessmentSection.FailureMechanismContribution.Norm)); Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/GuiServices/DuneLocationCalculationGuiServiceTest.cs =================================================================== diff -u -rc743d1f229ff553fff9a05964c1adac6e510df4a -rf0d6c65c6d7251bdc0c2cde6128d5777cff9ed49 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/GuiServices/DuneLocationCalculationGuiServiceTest.cs (.../DuneLocationCalculationGuiServiceTest.cs) (revision c743d1f229ff553fff9a05964c1adac6e510df4a) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/GuiServices/DuneLocationCalculationGuiServiceTest.cs (.../DuneLocationCalculationGuiServiceTest.cs) (revision f0d6c65c6d7251bdc0c2cde6128d5777cff9ed49) @@ -63,7 +63,7 @@ } [Test] - public void Calculate_LocationsNull_ThrowArgumentNullException() + public void Calculate_CalculationsNull_ThrowArgumentNullException() { // Setup using (var viewParent = new Form()) @@ -72,61 +72,39 @@ // Call TestDelegate test = () => guiService.Calculate(null, - dl => new DuneLocationCalculation(new TestDuneLocation()), validFilePath, validPreprocessorDirectory, 1.0 / 30000); // Assert var exception = Assert.Throws(test); - Assert.AreEqual("locations", exception.ParamName); + Assert.AreEqual("calculations", exception.ParamName); } } [Test] - public void Calculate_GetCalculationFuncNull_ThrowArgumentNullException() - { - // Setup - using (var viewParent = new Form()) - { - var guiService = new DuneLocationCalculationGuiService(viewParent); - - // Call - TestDelegate test = () => guiService.Calculate(Enumerable.Empty(), - null, - validFilePath, - validPreprocessorDirectory, - 1.0 / 30000); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("getCalculationFunc", exception.ParamName); - } - } - - [Test] public void Calculate_ValidData_ScheduleAllLocations() { // Setup - var duneLocations = new[] + var duneLocationCalculations = new[] { - new DuneLocation(1300001, "A", new Point2D(0, 0), new DuneLocation.ConstructionProperties + new DuneLocationCalculation(new DuneLocation(1300001, "A", new Point2D(0, 0), new DuneLocation.ConstructionProperties { CoastalAreaId = 0, Offset = 0, Orientation = 0, D50 = 0.000007 - }), - new DuneLocation(1300002, "B", new Point2D(0, 0), new DuneLocation.ConstructionProperties + })), + new DuneLocationCalculation(new DuneLocation(1300002, "B", new Point2D(0, 0), new DuneLocation.ConstructionProperties { CoastalAreaId = 0, Offset = 0, Orientation = 0, D50 = 0.000007 - }) + })) }; - int nrOfCalculators = duneLocations.Length; + int nrOfCalculators = duneLocationCalculations.Length; var calculatorFactory = mockRepository.StrictMock(); calculatorFactory.Expect(cf => cf.CreateDunesBoundaryConditionsCalculator(testDataPath, validPreprocessorDirectory)) .Return(new TestDunesBoundaryConditionsCalculator()) @@ -140,8 +118,7 @@ var guiService = new DuneLocationCalculationGuiService(viewParent); // Call - TestHelper.AssertLogMessages(() => guiService.Calculate(duneLocations, - dl => new DuneLocationCalculation(new TestDuneLocation()), + TestHelper.AssertLogMessages(() => guiService.Calculate(duneLocationCalculations, validFilePath, validPreprocessorDirectory, 1.0 / 200), @@ -190,8 +167,7 @@ var guiService = new DuneLocationCalculationGuiService(viewParent); // Call - Action call = () => guiService.Calculate(Enumerable.Empty(), - dl => new DuneLocationCalculation(new TestDuneLocation()), + Action call = () => guiService.Calculate(Enumerable.Empty(), databasePath, validPreprocessorDirectory, 1.0 / 30000); @@ -225,11 +201,10 @@ var guiService = new DuneLocationCalculationGuiService(viewParent); // Call - Action call = () => guiService.Calculate(new List + Action call = () => guiService.Calculate(new [] { - new TestDuneLocation(hydraulicLocationName) + new DuneLocationCalculation(new TestDuneLocation(hydraulicLocationName)) }, - dl => new DuneLocationCalculation(new TestDuneLocation()), validFilePath, validPreprocessorDirectory, 1.0 / 30000);