Index: Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs =================================================================== diff -u -r1042a38d3663daeda5a8e1083edbc63a4b6aae94 -r5fca1638d8f9510eebe352a8a9a86551d7ce9e61 --- Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs (.../HydraulicBoundaryLocationCalculationGuiService.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/GuiServices/HydraulicBoundaryLocationCalculationGuiService.cs (.../HydraulicBoundaryLocationCalculationGuiService.cs) (revision 5fca1638d8f9510eebe352a8a9a86551d7ce9e61) @@ -93,10 +93,10 @@ { throw new ArgumentNullException("locations"); } - var activities = locations.Select(location => new WaveHeightCalculationActivity(messageProvider, location, + var activities = locations.Select(location => new WaveHeightCalculationActivity(location, hydraulicBoundaryDatabasePath, ringId, - norm)).ToArray(); + norm, messageProvider)).ToArray(); return RunActivities(hydraulicBoundaryDatabasePath, activities); } Index: Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs =================================================================== diff -u -rc8743a6562e3e5581138be398f405b7f6b7c8976 -r5fca1638d8f9510eebe352a8a9a86551d7ce9e61 --- Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision c8743a6562e3e5581138be398f405b7f6b7c8976) +++ Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision 5fca1638d8f9510eebe352a8a9a86551d7ce9e61) @@ -22,7 +22,6 @@ using System; using Core.Common.Base.Data; using Core.Common.Base.Service; -using Core.Common.Utils; using log4net; using Ringtoets.Common.Service.MessageProviders; using Ringtoets.HydraRing.Calculation.Activities; @@ -82,9 +81,8 @@ return; } - PerformRun(() => DesignWaterLevelCalculationService.Instance.Validate( - messageProvider.GetCalculationName(hydraulicBoundaryLocation.Name), - hydraulicBoundaryDatabaseFilePath), + PerformRun(() => DesignWaterLevelCalculationService.Instance.Validate(messageProvider.GetCalculationName(hydraulicBoundaryLocation.Name), + hydraulicBoundaryDatabaseFilePath), () => RingtoetsCommonDataSynchronizationService.ClearDesignWaterLevel(hydraulicBoundaryLocation), () => DesignWaterLevelCalculationService.Instance.Calculate(hydraulicBoundaryLocation, hydraulicBoundaryDatabaseFilePath, Index: Ringtoets/Common/src/Ringtoets.Common.Service/RingtoetsCommonDataSynchronizationService.cs =================================================================== diff -u -rc8743a6562e3e5581138be398f405b7f6b7c8976 -r5fca1638d8f9510eebe352a8a9a86551d7ce9e61 --- Ringtoets/Common/src/Ringtoets.Common.Service/RingtoetsCommonDataSynchronizationService.cs (.../RingtoetsCommonDataSynchronizationService.cs) (revision c8743a6562e3e5581138be398f405b7f6b7c8976) +++ Ringtoets/Common/src/Ringtoets.Common.Service/RingtoetsCommonDataSynchronizationService.cs (.../RingtoetsCommonDataSynchronizationService.cs) (revision 5fca1638d8f9510eebe352a8a9a86551d7ce9e61) @@ -34,12 +34,12 @@ { /// /// Clears the output design water level - /// of the + /// of the . /// /// The - /// to clear the output for + /// to clear the output for. /// Thrown when - /// is null + /// is null. public static void ClearDesignWaterLevel(IHydraulicBoundaryLocation location) { if (location == null) @@ -52,12 +52,12 @@ /// /// Clears the output WaveHeight - /// of the + /// of the . /// /// The - /// to clear the output for + /// to clear the output for. /// Thrown when - /// is null + /// is null. public static void ClearWaveHeight(IHydraulicBoundaryLocation location) { if (location == null) @@ -69,18 +69,21 @@ } /// - /// + /// Determines whether the calculated output is converged, + /// based on the /// - /// - /// - /// + /// The resultant + /// object after a calculation. + /// The norm to use during the calculation. + /// True if the solution converged, false if otherwise + /// Thrown when + /// is null public static bool CalculationConverged(ReliabilityIndexCalculationOutput output, double norm) { if (output == null) { throw new ArgumentNullException("output"); } - double temp = StatisticsConverter.NormToBeta(norm); return Math.Abs(output.CalculatedReliabilityIndex - StatisticsConverter.NormToBeta(norm)) <= 1.0e-3; } } Index: Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs =================================================================== diff -u -rc8743a6562e3e5581138be398f405b7f6b7c8976 -r5fca1638d8f9510eebe352a8a9a86551d7ce9e61 --- Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs (.../WaveHeightCalculationActivity.cs) (revision c8743a6562e3e5581138be398f405b7f6b7c8976) +++ Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs (.../WaveHeightCalculationActivity.cs) (revision 5fca1638d8f9510eebe352a8a9a86551d7ce9e61) @@ -22,7 +22,6 @@ using System; using Core.Common.Base.Data; using Core.Common.Base.Service; -using Core.Common.Utils; using log4net; using Ringtoets.Common.Service.MessageProviders; using Ringtoets.HydraRing.Calculation.Activities; @@ -46,14 +45,13 @@ /// /// Creates a new instance of . /// - /// The provider of the messages to use during the calculation. /// The to perform the calculation for. /// 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. + /// The provider of the messages to use during the calculation. /// Thrown when is null. - public WaveHeightCalculationActivity(ICalculationMessageProvider messageProvider, - IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath, string ringId, double norm) + public WaveHeightCalculationActivity(IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath, string ringId, double norm, ICalculationMessageProvider messageProvider) { if (hydraulicBoundaryLocation == null) { @@ -83,9 +81,8 @@ return; } - PerformRun(() => WaveHeightCalculationService.Instance.Validate( - messageProvider.GetCalculationName(hydraulicBoundaryLocation.Name), - hydraulicBoundaryDatabaseFilePath), + PerformRun(() => WaveHeightCalculationService.Instance.Validate(messageProvider.GetCalculationName(hydraulicBoundaryLocation.Name), + hydraulicBoundaryDatabaseFilePath), () => RingtoetsCommonDataSynchronizationService.ClearWaveHeight(hydraulicBoundaryLocation), () => WaveHeightCalculationService.Instance.Calculate(hydraulicBoundaryLocation, hydraulicBoundaryDatabaseFilePath, @@ -97,7 +94,7 @@ PerformFinish(() => { hydraulicBoundaryLocation.WaveHeight = (RoundedDouble) Output.Result; - bool waveHeightCalculationConvergence = RingtoetsCommonDataSynchronizationService.CalculationConverged(Output, norm); + bool waveHeightCalculationConvergence = RingtoetsCommonDataSynchronizationService.CalculationConverged(Output, norm); if (!waveHeightCalculationConvergence) { log.WarnFormat(messageProvider.GetCalculatedNotConvergedMessage(hydraulicBoundaryLocation.Name)); Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationCalculationGuiServiceTest.cs =================================================================== diff -u -r1042a38d3663daeda5a8e1083edbc63a4b6aae94 -r5fca1638d8f9510eebe352a8a9a86551d7ce9e61 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationCalculationGuiServiceTest.cs (.../HydraulicBoundaryLocationCalculationGuiServiceTest.cs) (revision 1042a38d3663daeda5a8e1083edbc63a4b6aae94) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/GuiServices/HydraulicBoundaryLocationCalculationGuiServiceTest.cs (.../HydraulicBoundaryLocationCalculationGuiServiceTest.cs) (revision 5fca1638d8f9510eebe352a8a9a86551d7ce9e61) @@ -257,11 +257,11 @@ { var msgs = messages.ToArray(); Assert.AreEqual(6, msgs.Length); - StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculationName), msgs.First()); - StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculationName), msgs.Skip(1).First()); - StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculationName), msgs.Skip(2).First()); - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculationName), msgs.Skip(3).First()); - StringAssert.AreNotEqualIgnoringCase(string.Format("Uitvoeren van '{0}' is mislukt.", calculationName), msgs.Last()); + StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculationName), msgs[0]); + StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculationName), msgs[1]); + StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculationName), msgs[2]); + StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculationName), msgs[3]); + StringAssert.AreNotEqualIgnoringCase(string.Format("Uitvoeren van '{0}' is mislukt.", calculationName), msgs[4]); }); } mockRepository.VerifyAll(); @@ -489,11 +489,11 @@ { var msgs = messages.ToArray(); Assert.AreEqual(6, msgs.Length); - StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculationName), msgs.First()); - StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculationName), msgs.Skip(1).First()); - StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculationName), msgs.Skip(2).First()); - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculationName), msgs.Skip(3).First()); - StringAssert.AreNotEqualIgnoringCase(string.Format("Uitvoeren van '{0}' is mislukt.", calculationName), msgs.Last()); + StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculationName), msgs[0]); + StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculationName), msgs[1]); + StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculationName), msgs[2]); + StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculationName), msgs[3]); + StringAssert.AreNotEqualIgnoringCase(string.Format("Uitvoeren van '{0}' is mislukt.", calculationName), msgs[4]); }); } mockRepository.VerifyAll(); Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/HydraulicBoundaryLocationCalculationServiceTest.cs =================================================================== diff -u -rb0aaf56d72d242f5d1112d007bfbf51826f5ea59 -r5fca1638d8f9510eebe352a8a9a86551d7ce9e61 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/HydraulicBoundaryLocationCalculationServiceTest.cs (.../HydraulicBoundaryLocationCalculationServiceTest.cs) (revision b0aaf56d72d242f5d1112d007bfbf51826f5ea59) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/HydraulicBoundaryLocationCalculationServiceTest.cs (.../HydraulicBoundaryLocationCalculationServiceTest.cs) (revision 5fca1638d8f9510eebe352a8a9a86551d7ce9e61) @@ -128,15 +128,15 @@ using (new HydraRingCalculationServiceConfig()) { - var testService = (TestHydraRingCalculationService)HydraRingCalculationService.Instance; + var testService = (TestHydraRingCalculationService) HydraRingCalculationService.Instance; var service = new TestHydraulicBoundaryLocationCalculationService(); // Call service.Calculate(hydraulicBoundaryLocationMock, - validFilePath, - ringId, - norm, + validFilePath, + ringId, + norm, calculationMessageProviderMock); // Assert Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationActivityTest.cs =================================================================== diff -u -ra08664f5b196db59fc81cbbd33672627060d38c0 -r5fca1638d8f9510eebe352a8a9a86551d7ce9e61 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationActivityTest.cs (.../WaveHeightCalculationActivityTest.cs) (revision a08664f5b196db59fc81cbbd33672627060d38c0) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationActivityTest.cs (.../WaveHeightCalculationActivityTest.cs) (revision 5fca1638d8f9510eebe352a8a9a86551d7ce9e61) @@ -63,7 +63,7 @@ string validFilePath = Path.Combine(testDataPath, validFile); // Call - var activity = new WaveHeightCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock, validFilePath, "", 1); + var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocationMock, validFilePath, "", 1, calculationMessageProviderMock); // Assert Assert.IsInstanceOf(activity); @@ -82,7 +82,7 @@ string validFilePath = Path.Combine(testDataPath, validFile); // Call - TestDelegate call = () => new WaveHeightCalculationActivity(null, hydraulicBoundaryLocationMock, validFilePath, "", 1); + TestDelegate call = () => new WaveHeightCalculationActivity(hydraulicBoundaryLocationMock, validFilePath, "", 1, null); // Assert var exception = Assert.Throws(call); @@ -100,7 +100,7 @@ string validFilePath = Path.Combine(testDataPath, validFile); // Call - TestDelegate call = () => new WaveHeightCalculationActivity(calculationMessageProviderMock, null, validFilePath, "", 1); + TestDelegate call = () => new WaveHeightCalculationActivity(null, validFilePath, "", 1, calculationMessageProviderMock); // Assert var exception = Assert.Throws(call); @@ -128,8 +128,7 @@ calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return(calculationName).Repeat.AtLeastOnce(); mockRepository.ReplayAll(); - var activity = new WaveHeightCalculationActivity(calculationMessageProviderMock, - hydraulicBoundaryLocationMock, inValidFilePath, "", 1); + var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocationMock, inValidFilePath, "", 1, calculationMessageProviderMock); // Call Action call = () => activity.Run(); @@ -166,11 +165,10 @@ calculationMessageProviderMock.Expect(calc => calc.GetCalculationName(locationName)).Return(calculationName).Repeat.AtLeastOnce(); mockRepository.ReplayAll(); - var activity = new WaveHeightCalculationActivity(calculationMessageProviderMock, - hydraulicBoundaryLocationMock, + var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocationMock, validFilePath, ringId, - norm); + norm, calculationMessageProviderMock); using (new WaveHeightCalculationServiceConfig()) { @@ -206,8 +204,7 @@ calculationMessageProviderMock.Expect(calc => calc.GetActivityName(locationName)).Return(activityName); mockRepository.ReplayAll(); - var activity = new WaveHeightCalculationActivity(calculationMessageProviderMock, - hydraulicBoundaryLocationMock, validFilePath, "", 30); + var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocationMock, validFilePath, "", 30, calculationMessageProviderMock); // Call Action call = () => activity.Run(); @@ -239,8 +236,8 @@ string validFilePath = Path.Combine(testDataPath, validFile); - var activity = new WaveHeightCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock, - validFilePath, "", 30); + var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocationMock, + validFilePath, "", 30, calculationMessageProviderMock); using (new WaveHeightCalculationServiceConfig()) { @@ -273,8 +270,8 @@ string validFilePath = Path.Combine(testDataPath, validFile); - var activity = new WaveHeightCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock, - validFilePath, "", 30); + var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocationMock, + validFilePath, "", 30, calculationMessageProviderMock); using (new WaveHeightCalculationServiceConfig()) { @@ -314,11 +311,10 @@ string validFilePath = Path.Combine(testDataPath, validFile); const int norm = 300; - var activity = new WaveHeightCalculationActivity(calculationMessageProviderMock, - hydraulicBoundaryLocationMock, + var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocationMock, validFilePath, "", - norm); + norm, calculationMessageProviderMock); using (new WaveHeightCalculationServiceConfig()) { @@ -358,7 +354,7 @@ string validFilePath = Path.Combine(testDataPath, validFile); - var activity = new WaveHeightCalculationActivity(calculationMessageProviderMock, hydraulicBoundaryLocationMock, validFilePath, "", 30); + var activity = new WaveHeightCalculationActivity(hydraulicBoundaryLocationMock, validFilePath, "", 30, calculationMessageProviderMock); activity.Run();