Index: Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs
===================================================================
diff -u -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 -r06b2840a2bb64c0960c8ac29322b5a0971c73c77
--- Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision 06b2840a2bb64c0960c8ac29322b5a0971c73c77)
@@ -24,7 +24,7 @@
using Core.Common.Base.Service;
using Core.Common.Utils;
using log4net;
-using Ringtoets.Common.Service.Properties;
+using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.HydraRing.Calculation.Activities;
using Ringtoets.HydraRing.Calculation.Data.Output;
using Ringtoets.HydraRing.Data;
@@ -41,29 +41,39 @@
private readonly double norm;
private readonly string hydraulicBoundaryDatabaseFilePath;
private readonly string ringId;
+ private readonly ICalculationMessageProvider messageProvider;
///
/// 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.
/// Thrown when is null.
- public DesignWaterLevelCalculationActivity(IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath, string ringId, double norm)
+ public DesignWaterLevelCalculationActivity(ICalculationMessageProvider messageProvider,
+ IHydraulicBoundaryLocation hydraulicBoundaryLocation,
+ string hydraulicBoundaryDatabaseFilePath,
+ string ringId, double norm)
{
if (hydraulicBoundaryLocation == null)
{
throw new ArgumentNullException("hydraulicBoundaryLocation");
}
-
this.hydraulicBoundaryLocation = hydraulicBoundaryLocation;
+
+ if (messageProvider == null)
+ {
+ throw new ArgumentNullException("messageProvider");
+ }
+ this.messageProvider = messageProvider;
+
this.hydraulicBoundaryDatabaseFilePath = hydraulicBoundaryDatabaseFilePath;
this.ringId = ringId;
this.norm = norm;
- Name = string.Format(Resources.DesignWaterLevelCalculationService_Name_Calculate_assessment_level_for_location_0_,
- hydraulicBoundaryLocation.Name);
+ Name = messageProvider.GetActivityName(hydraulicBoundaryLocation.Name);
}
protected override void OnRun()
@@ -74,10 +84,12 @@
return;
}
- PerformRun(() => DesignWaterLevelCalculationService.Validate(hydraulicBoundaryLocation, hydraulicBoundaryDatabaseFilePath),
+ PerformRun(() => DesignWaterLevelCalculationService.Validate(
+ messageProvider.GetCalculationName(hydraulicBoundaryLocation.Name), hydraulicBoundaryDatabaseFilePath),
() => hydraulicBoundaryLocation.DesignWaterLevel = (RoundedDouble) double.NaN,
- () => DesignWaterLevelCalculationService.Calculate(hydraulicBoundaryLocation, hydraulicBoundaryDatabaseFilePath,
- ringId, norm));
+ () => DesignWaterLevelCalculationService.Calculate(
+ messageProvider, hydraulicBoundaryLocation, hydraulicBoundaryDatabaseFilePath,
+ ringId, norm));
}
protected override void OnFinish()
@@ -89,7 +101,7 @@
Math.Abs(Output.CalculatedReliabilityIndex - StatisticsConverter.NormToBeta(norm)) <= 1.0e-3;
if (!designWaterLevelCalculationConvergence)
{
- log.WarnFormat(Resources.DesignWaterLevelCalculationActivity_DesignWaterLevel_calculation_for_location_0_not_converged, hydraulicBoundaryLocation.Name);
+ log.Warn(messageProvider.GetCalculatedNotConvergedMessage(hydraulicBoundaryLocation.Name));
}
hydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence = designWaterLevelCalculationConvergence
? CalculationConvergence.CalculatedConverged