Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationActivity.cs
===================================================================
diff -u -r76948e8765899b35776102ecd211d3d7575a9e4d -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationActivity.cs (.../ClosingStructuresCalculationActivity.cs) (revision 76948e8765899b35776102ecd211d3d7575a9e4d)
+++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationActivity.cs (.../ClosingStructuresCalculationActivity.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -91,8 +91,10 @@
calculation.ClearOutput();
calculationService.Calculate(calculation,
- assessmentSection,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSection.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
hydraulicBoundaryDatabaseFilePath);
}
Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationMessageProvider.cs
===================================================================
diff -u -r461842cc9a0a60d00900065b9a7db474db7d7548 -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationMessageProvider.cs (.../ClosingStructuresCalculationMessageProvider.cs) (revision 461842cc9a0a60d00900065b9a7db474db7d7548)
+++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationMessageProvider.cs (.../ClosingStructuresCalculationMessageProvider.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -41,10 +41,10 @@
calculationSubject, errorReport);
}
- public string GetCalculationPerformedMessage(string calculationSubject)
+ public string GetCalculationPerformedMessage(string outputDirectory)
{
return string.Format(Resources.ClosingStructuresCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0,
- calculationSubject);
+ outputDirectory);
}
}
}
\ No newline at end of file
Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationService.cs
===================================================================
diff -u -r6e0a4fb94b3cd5631842025c95d2b1460fc7a6ce -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationService.cs (.../ClosingStructuresCalculationService.cs) (revision 6e0a4fb94b3cd5631842025c95d2b1460fc7a6ce)
+++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationService.cs (.../ClosingStructuresCalculationService.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -20,47 +20,38 @@
// All rights reserved.
using System.ComponentModel;
-using log4net;
using Ringtoets.ClosingStructures.Data;
-using Ringtoets.ClosingStructures.Service.Properties;
-using Ringtoets.Common.Data.AssessmentSection;
-using Ringtoets.Common.Data.Probability;
using Ringtoets.Common.Data.Structures;
using Ringtoets.Common.Service;
-using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.Common.Service.Structures;
-using Ringtoets.HydraRing.Calculation.Calculator;
using Ringtoets.HydraRing.Calculation.Data.Input.Structures;
-using Ringtoets.HydraRing.Calculation.Exceptions;
namespace Ringtoets.ClosingStructures.Service
{
///
/// Service that provides methods for performing Hydra-ring calculations for closing structures.
///
public class ClosingStructuresCalculationService : StructuresCalculationServiceBase
+ ClosingStructuresInput, ClosingStructure, GeneralClosingStructuresInput, StructuresClosureCalculationInput>
{
- private static readonly ILog log = LogManager.GetLogger(typeof(ClosingStructuresCalculationService));
-
///
/// Creates a new instance of .
///
public ClosingStructuresCalculationService() : base(new ClosingStructuresCalculationMessageProvider()) {}
- protected override StructuresClosureCalculationInput CreateInput(StructuresCalculation calculation, ClosingStructuresFailureMechanism failureMechanism, string hydraulicBoundaryDatabaseFilePath)
+ protected override StructuresClosureCalculationInput CreateInput(StructuresCalculation calculation, GeneralClosingStructuresInput generalInput, string hydraulicBoundaryDatabaseFilePath)
{
StructuresClosureCalculationInput input;
switch (calculation.InputParameters.InflowModelType)
{
case ClosingStructureInflowModelType.VerticalWall:
- input = CreateClosureVerticalWallCalculationInput(calculation, failureMechanism.GeneralInput);
+ input = CreateClosureVerticalWallCalculationInput(calculation, generalInput);
break;
case ClosingStructureInflowModelType.LowSill:
- input = CreateLowSillCalculationInput(calculation, failureMechanism.GeneralInput);
+ input = CreateLowSillCalculationInput(calculation, generalInput);
break;
case ClosingStructureInflowModelType.FloodedCulvert:
- input = CreateFloodedCulvertCalculationInput(calculation, failureMechanism.GeneralInput);
+ input = CreateFloodedCulvertCalculationInput(calculation, generalInput);
break;
default:
throw new InvalidEnumArgumentException(nameof(calculation),
@@ -72,69 +63,6 @@
return input;
}
- protected override void PerformCalculation(IStructuresCalculator calculator,
- StructuresClosureCalculationInput input,
- StructuresCalculation calculation,
- IAssessmentSection assessmentSection,
- ClosingStructuresFailureMechanism failureMechanism)
- {
- var exceptionThrown = false;
-
- try
- {
- calculator.Calculate(input);
-
- if (!Canceled && string.IsNullOrEmpty(calculator.LastErrorFileContent))
- {
- ProbabilityAssessmentOutput probabilityAssessmentOutput =
- ProbabilityAssessmentService.Calculate(assessmentSection.FailureMechanismContribution.Norm,
- failureMechanism.Contribution,
- failureMechanism.GeneralInput.N,
- calculator.ExceedanceProbabilityBeta);
- calculation.Output = new StructuresOutput(probabilityAssessmentOutput);
- }
- }
- catch (HydraRingCalculationException)
- {
- if (!Canceled)
- {
- string lastErrorFileContent = calculator.LastErrorFileContent;
- if (string.IsNullOrEmpty(lastErrorFileContent))
- {
- log.ErrorFormat(Resources.ClosingStructuresCalculationService_Calculate_Error_in_ClosingStructuresCalculation_0_no_error_report,
- calculation.Name);
- }
- else
- {
- log.ErrorFormat(Resources.ClosingStructuresCalculationService_Calculate_Error_in_ClosingStructuresCalculation_0_click_details_for_last_error_report_1,
- calculation.Name, lastErrorFileContent);
- }
-
- exceptionThrown = true;
- throw;
- }
- }
- finally
- {
- string lastErrorFileContent = calculator.LastErrorFileContent;
- bool errorOccurred = CalculationServiceHelper.HasErrorOccurred(Canceled, exceptionThrown, lastErrorFileContent);
- if (errorOccurred)
- {
- log.ErrorFormat(Resources.ClosingStructuresCalculationService_Calculate_Error_in_ClosingStructuresCalculation_0_click_details_for_last_error_report_1,
- calculation.Name, lastErrorFileContent);
- }
-
- log.InfoFormat(Resources.ClosingStructuresCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0,
- calculator.OutputDirectory);
- CalculationServiceHelper.LogCalculationEnd();
-
- if (errorOccurred)
- {
- throw new HydraRingCalculationException(lastErrorFileContent);
- }
- }
- }
-
private static StructuresClosureVerticalWallCalculationInput CreateClosureVerticalWallCalculationInput(
StructuresCalculation calculation,
GeneralClosingStructuresInput generalInput)
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationMessageProviderTest.cs
===================================================================
diff -u -r461842cc9a0a60d00900065b9a7db474db7d7548 -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationMessageProviderTest.cs (.../ClosingStructuresCalculationMessageProviderTest.cs) (revision 461842cc9a0a60d00900065b9a7db474db7d7548)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationMessageProviderTest.cs (.../ClosingStructuresCalculationMessageProviderTest.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -78,16 +78,16 @@
[TestCase(null)]
[TestCase("")]
[TestCase("value")]
- public void GetCalculationPerformedMessage_VariousParameters_ReturnsExpectedValue(string name)
+ public void GetCalculationPerformedMessage_VariousParameters_ReturnsExpectedValue(string directory)
{
// Setup
var provider = new ClosingStructuresCalculationMessageProvider();
// Call
- string message = provider.GetCalculationPerformedMessage(name);
+ string message = provider.GetCalculationPerformedMessage(directory);
// Assert
- string expectedMessage = $"Betrouwbaarheid sluiting kunstwerk berekening is uitgevoerd op de tijdelijke locatie '{name}'. " +
+ string expectedMessage = $"Betrouwbaarheid sluiting kunstwerk berekening is uitgevoerd op de tijdelijke locatie '{directory}'. " +
"Gedetailleerde invoer en uitvoer kan in de bestanden op deze locatie worden gevonden.";
Assert.AreEqual(expectedMessage, message);
}
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs
===================================================================
diff -u -rfa05755175660f1738a1c3bf82fb4505b93ffa1f -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs (.../ClosingStructuresCalculationServiceTest.cs) (revision fa05755175660f1738a1c3bf82fb4505b93ffa1f)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs (.../ClosingStructuresCalculationServiceTest.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -60,7 +60,7 @@
// Assert
Assert.IsInstanceOf>(service);
+ ClosingStructure, GeneralClosingStructuresInput, StructuresClosureCalculationInput>>(service);
}
[Test]
@@ -331,15 +331,16 @@
public void Calculate_InvalidInFlowModelType_ThrowsInvalidEnumArgumentException()
{
// Setup
- var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism();
- closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[]
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("test section", new[]
{
new Point2D(0, 0),
new Point2D(1, 1)
}));
var mockRepository = new MockRepository();
- var assessmentSectionStub = mockRepository.Stub();
+ IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism,
+ mockRepository);
var calculatorFactory = mockRepository.StrictMock();
mockRepository.ReplayAll();
@@ -358,8 +359,10 @@
{
// Call
TestDelegate call = () => service.Calculate(calculation,
- assessmentSectionStub,
- closingStructuresFailureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
@@ -378,10 +381,10 @@
public void Calculate_VariousVerticalWallCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater)
{
// Setup
- var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism();
+ var failureMechanism = new ClosingStructuresFailureMechanism();
var mockRepository = new MockRepository();
- IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism,
+ IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism,
mockRepository);
var calculator = new TestStructuresCalculator();
@@ -407,15 +410,17 @@
{
// Call
new ClosingStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- closingStructuresFailureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
StructuresClosureCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray();
Assert.AreEqual(1, calculationInputs.Length);
- GeneralClosingStructuresInput generalInput = closingStructuresFailureMechanism.GeneralInput;
+ GeneralClosingStructuresInput generalInput = failureMechanism.GeneralInput;
ClosingStructuresInput input = calculation.InputParameters;
var expectedInput = new StructuresClosureVerticalWallCalculationInput(
1300001,
@@ -457,10 +462,10 @@
public void Calculate_VariousLowSillCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater)
{
// Setup
- var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism();
+ var failureMechanism = new ClosingStructuresFailureMechanism();
var mockRepository = new MockRepository();
- IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism,
+ IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism,
mockRepository);
var calculator = new TestStructuresCalculator();
@@ -487,15 +492,17 @@
{
// Call
new ClosingStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- closingStructuresFailureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
StructuresClosureCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray();
Assert.AreEqual(1, calculationInputs.Length);
- GeneralClosingStructuresInput generalInput = closingStructuresFailureMechanism.GeneralInput;
+ GeneralClosingStructuresInput generalInput = failureMechanism.GeneralInput;
ClosingStructuresInput input = calculation.InputParameters;
var expectedInput = new StructuresClosureLowSillCalculationInput(
1300001,
@@ -536,10 +543,10 @@
public void Calculate_VariousFloodedCulvertCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater)
{
// Setup
- var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism();
+ var failureMechanism = new ClosingStructuresFailureMechanism();
var mockRepository = new MockRepository();
- IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism,
+ IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism,
mockRepository);
var calculator = new TestStructuresCalculator();
var calculatorFactory = mockRepository.StrictMock();
@@ -565,15 +572,17 @@
{
// Call
new ClosingStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- closingStructuresFailureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
StructuresClosureCalculationInput[] calculationInputs = calculator.ReceivedInputs.ToArray();
Assert.AreEqual(1, calculationInputs.Length);
- GeneralClosingStructuresInput generalInput = closingStructuresFailureMechanism.GeneralInput;
+ GeneralClosingStructuresInput generalInput = failureMechanism.GeneralInput;
ClosingStructuresInput input = calculation.InputParameters;
var expectedInput = new StructuresClosureFloodedCulvertCalculationInput(
1300001,
@@ -612,15 +621,15 @@
[Values(CalculationType.NoForeshore, CalculationType.ForeshoreWithoutBreakWater, CalculationType.ForeshoreWithValidBreakWater)] CalculationType calculationType)
{
// Setup
- var closingStructuresFailureMechanism = new ClosingStructuresFailureMechanism();
- closingStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[]
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("test section", new[]
{
new Point2D(0, 0),
new Point2D(1, 1)
}));
var mockRepository = new MockRepository();
- IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(closingStructuresFailureMechanism,
+ IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism,
mockRepository);
var calculatorFactory = mockRepository.StrictMock();
calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath))
@@ -658,8 +667,10 @@
using (new HydraRingCalculatorFactoryConfig(calculatorFactory))
{
Action call = () => new ClosingStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- closingStructuresFailureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
@@ -719,8 +730,10 @@
try
{
new ClosingStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
}
catch (HydraRingCalculationException)
@@ -786,8 +799,10 @@
try
{
new ClosingStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
}
catch (HydraRingCalculationException)
@@ -855,8 +870,10 @@
try
{
new ClosingStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
}
catch (HydraRingCalculationException e)
Index: Ringtoets/Common/src/Ringtoets.Common.Service/MessageProviders/IStructuresCalculationMessageProvider.cs
===================================================================
diff -u -r461842cc9a0a60d00900065b9a7db474db7d7548 -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/Common/src/Ringtoets.Common.Service/MessageProviders/IStructuresCalculationMessageProvider.cs (.../IStructuresCalculationMessageProvider.cs) (revision 461842cc9a0a60d00900065b9a7db474db7d7548)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/MessageProviders/IStructuresCalculationMessageProvider.cs (.../IStructuresCalculationMessageProvider.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -44,8 +44,8 @@
///
/// Gets the message that should be used when a calculation is performed.
///
- /// The calculation subject used in the calculation name.
+ /// The output directory used in the calculation.
/// The message.
- string GetCalculationPerformedMessage(string calculationSubject);
+ string GetCalculationPerformedMessage(string outputDirectory);
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Service/Structures/StructuresCalculationServiceBase.cs
===================================================================
diff -u -r6e0a4fb94b3cd5631842025c95d2b1460fc7a6ce -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/Common/src/Ringtoets.Common.Service/Structures/StructuresCalculationServiceBase.cs (.../StructuresCalculationServiceBase.cs) (revision 6e0a4fb94b3cd5631842025c95d2b1460fc7a6ce)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/Structures/StructuresCalculationServiceBase.cs (.../StructuresCalculationServiceBase.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -25,9 +25,11 @@
using System.IO;
using System.Linq;
using Core.Common.Base.IO;
+using log4net;
using Ringtoets.Common.Data;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.Probability;
using Ringtoets.Common.Data.Structures;
using Ringtoets.Common.IO.HydraRing;
using Ringtoets.Common.Service.MessageProviders;
@@ -46,19 +48,23 @@
/// The type of the validation rules.
/// The structure input type.
/// The structure type.
- /// The failure mechanism type.
+ /// The general input type.
/// The calculation input type.
- public abstract class StructuresCalculationServiceBase
+ public abstract class StructuresCalculationServiceBase
where TStructureValidationRules : IStructuresValidationRulesRegistry, new()
where TStructureInput : StructuresInputBase, new()
where TStructure : StructureBase
- where TFailureMechanism : IFailureMechanism
+ where TGeneralInput : class
where TCalculationInput : ExceedanceProbabilityCalculationInput
{
+ private readonly IStructuresCalculationMessageProvider messageProvider;
+ private static readonly ILog log = LogManager.GetLogger(typeof(StructuresCalculationServiceBase));
+
private IStructuresCalculator calculator;
+ private bool canceled;
///
- /// Creates a new instance of .
+ /// Creates a new instance of .
///
/// The object which is used to build log messages.
/// Thrown when
@@ -69,6 +75,8 @@
{
throw new ArgumentNullException(nameof(messageProvider));
}
+
+ this.messageProvider = messageProvider;
}
///
@@ -105,12 +113,13 @@
/// if the calculation was successful. Error and status information is logged during the execution of the operation.
///
/// The that holds all the information required to perform the calculation.
- /// The that holds information about the norm used in the calculation.
- /// The that holds the information about the contribution
- /// and the general inputs used in the calculation.
+ /// The general inputs used in the calculations.
+ /// The 'N' parameter used to factor in the 'length effect'.
+ /// The norm used in the calculation.
+ /// The contribution used in the calculation.
/// The path which points to the hydraulic boundary database file.
- /// Thrown when ,
- /// or is null.
+ /// Thrown when or
+ /// is null.
/// Thrown when the
/// contains invalid characters.
/// Thrown when an unexpected
@@ -124,31 +133,78 @@
///
/// Thrown when an error occurs while performing the calculation.
public void Calculate(StructuresCalculation calculation,
- IAssessmentSection assessmentSection,
- TFailureMechanism failureMechanism,
+ TGeneralInput generalInput,
+ double lengthEffectN,
+ double norm,
+ double contribution,
string hydraulicBoundaryDatabaseFilePath)
{
if (calculation == null)
{
throw new ArgumentNullException(nameof(calculation));
}
- if (assessmentSection == null)
+ if (generalInput == null)
{
- throw new ArgumentNullException(nameof(assessmentSection));
+ throw new ArgumentNullException(nameof(generalInput));
}
- if (failureMechanism == null)
- {
- throw new ArgumentNullException(nameof(failureMechanism));
- }
- TCalculationInput input = CreateInput(calculation, failureMechanism, hydraulicBoundaryDatabaseFilePath);
+ TCalculationInput input = CreateInput(calculation, generalInput, hydraulicBoundaryDatabaseFilePath);
string hlcdDirectory = Path.GetDirectoryName(hydraulicBoundaryDatabaseFilePath);
calculator = HydraRingCalculatorFactory.Instance.CreateStructuresCalculator(hlcdDirectory);
+ string calculationName = calculation.Name;
CalculationServiceHelper.LogCalculationBegin();
- PerformCalculation(calculator, input, calculation, assessmentSection, failureMechanism);
+ var exceptionThrown = false;
+ try
+ {
+ calculator.Calculate(input);
+
+ if (!canceled && string.IsNullOrEmpty(calculator.LastErrorFileContent))
+ {
+ ProbabilityAssessmentOutput probabilityAssessmentOutput =
+ ProbabilityAssessmentService.Calculate(norm,
+ contribution,
+ lengthEffectN,
+ calculator.ExceedanceProbabilityBeta);
+ calculation.Output = new StructuresOutput(probabilityAssessmentOutput);
+ }
+ }
+ catch (HydraRingCalculationException)
+ {
+ if (!canceled)
+ {
+ string lastErrorFileContent = calculator.LastErrorFileContent;
+
+ string message = string.IsNullOrEmpty(lastErrorFileContent)
+ ? messageProvider.GetCalculationFailedMessage(calculationName)
+ : messageProvider.GetCalculationFailedWithErrorReportMessage(calculationName, lastErrorFileContent);
+
+ log.Error(message);
+
+ exceptionThrown = true;
+ throw;
+ }
+ }
+ finally
+ {
+ string lastErrorFileContent = calculator.LastErrorFileContent;
+ bool errorOccurred = CalculationServiceHelper.HasErrorOccurred(canceled, exceptionThrown, lastErrorFileContent);
+ if (errorOccurred)
+ {
+ log.Error(messageProvider.GetCalculationFailedWithErrorReportMessage(calculationName, lastErrorFileContent));
+ }
+
+ log.Info(messageProvider.GetCalculationPerformedMessage(calculator.OutputDirectory));
+
+ CalculationServiceHelper.LogCalculationEnd();
+
+ if (errorOccurred)
+ {
+ throw new HydraRingCalculationException(lastErrorFileContent);
+ }
+ }
}
///
@@ -157,37 +213,14 @@
public void Cancel()
{
calculator?.Cancel();
- Canceled = true;
+ canceled = true;
}
///
- /// Gets the indicator whether the calculation is canceled.
- ///
- protected bool Canceled { get; private set; }
-
- ///
- /// Performs a structures calculation based on the supplied and sets
- /// if the calculation was successful. Error and status information is logged during the execution of the operation.
- ///
- /// The calculator to perform the calculation with.
- /// The input of the calculation.
- /// The that holds all the information required to perform the calculation.
- /// The that holds information about the norm used in the calculation.
- /// The that holds the information about the contribution
- /// and the general inputs used in the calculation.
- /// Thrown when an error occurs while performing the calculation.
- protected abstract void PerformCalculation(IStructuresCalculator calculator,
- TCalculationInput input,
- StructuresCalculation calculation,
- IAssessmentSection assessmentSection,
- TFailureMechanism failureMechanism);
-
- ///
/// Creates the input for a structures calculation.
///
/// The calculation to create the input for.
- /// The that holds the information about
- /// the contribution and the general inputs used in the calculation.
+ /// The that is used in the calculation.
/// The path to the hydraulic boundary database file.
/// A .
/// Thrown when the
@@ -203,7 +236,7 @@
///
///
protected abstract TCalculationInput CreateInput(StructuresCalculation calculation,
- TFailureMechanism failureMechanism,
+ TGeneralInput generalInput,
string hydraulicBoundaryDatabaseFilePath);
private static string[] ValidateInput(TStructureInput input, IAssessmentSection assessmentSection)
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs
===================================================================
diff -u -r6e0a4fb94b3cd5631842025c95d2b1460fc7a6ce -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs (.../StructuresCalculationServiceBaseTest.cs) (revision 6e0a4fb94b3cd5631842025c95d2b1460fc7a6ce)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/Structures/StructuresCalculationServiceBaseTest.cs (.../StructuresCalculationServiceBaseTest.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -33,10 +33,10 @@
using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.Common.Service.Structures;
using Ringtoets.Common.Service.TestUtil;
-using Ringtoets.HydraRing.Calculation.Calculator;
using Ringtoets.HydraRing.Calculation.Calculator.Factory;
using Ringtoets.HydraRing.Calculation.Data;
using Ringtoets.HydraRing.Calculation.Data.Input;
+using Ringtoets.HydraRing.Calculation.Exceptions;
using Ringtoets.HydraRing.Calculation.TestUtil;
using Ringtoets.HydraRing.Calculation.TestUtil.Calculator;
@@ -334,17 +334,20 @@
public void Calculate_CalculationNull_ThrowArgumentNullException()
{
// Setup
+ var failureMechanism = new TestFailureMechanism();
+
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism,
+ mocks);
mocks.ReplayAll();
- var failureMechanism = new TestFailureMechanism();
-
// Call
TestDelegate test = () => new TestStructuresCalculationService(new TestMessageProvider()).Calculate(null,
- assessmentSection,
- failureMechanism,
- string.Empty);
+ new GeneralTestInput(),
+ 0,
+ assessmentSection.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
+ string.Empty);
// Assert
var exception = Assert.Throws(test);
@@ -353,42 +356,29 @@
}
[Test]
- public void Calculate_AssessmentSectionNull_ThrowArgumentNullException()
+ public void Calculate_GeneralInputNull_ThrowArgumentNullException()
{
// Setup
- var calculation = new TestStructuresCalculation();
var failureMechanism = new TestFailureMechanism();
- // Call
- TestDelegate test = () => new TestStructuresCalculationService(new TestMessageProvider()).Calculate(calculation,
- null,
- failureMechanism,
- string.Empty);
-
- // Assert
- var exception = Assert.Throws(test);
- Assert.AreEqual("assessmentSection", exception.ParamName);
- }
-
- [Test]
- public void Calculate_FailureMechanismNull_ThrowArgumentNullException()
- {
- // Setup
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism,
+ mocks);
mocks.ReplayAll();
var calculation = new TestStructuresCalculation();
// Call
TestDelegate test = () => new TestStructuresCalculationService(new TestMessageProvider()).Calculate(calculation,
- assessmentSection,
- null,
- string.Empty);
+ null,
+ 0,
+ assessmentSection.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
+ string.Empty);
// Assert
var exception = Assert.Throws(test);
- Assert.AreEqual("failureMechanism", exception.ParamName);
+ Assert.AreEqual("generalInput", exception.ParamName);
mocks.VerifyAll();
}
@@ -398,14 +388,14 @@
// Setup
var failureMechanism = new TestFailureMechanism();
- var mockRepository = new MockRepository();
+ var mocks = new MockRepository();
IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism,
- mockRepository);
+ mocks);
var calculator = new TestStructuresCalculator();
- var calculatorFactory = mockRepository.StrictMock();
+ var calculatorFactory = mocks.StrictMock();
calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath))
.Return(calculator);
- mockRepository.ReplayAll();
+ mocks.ReplayAll();
var calculation = new TestStructuresCalculation
{
@@ -421,8 +411,10 @@
// Call
service.Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ new GeneralTestInput(),
+ 0,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
@@ -434,7 +426,7 @@
HydraRingDataEqualityHelper.AreEqual(expectedInput, actualInput);
Assert.IsFalse(calculator.IsCanceled);
}
- mockRepository.VerifyAll();
+ mocks.VerifyAll();
}
[Test]
@@ -443,14 +435,14 @@
// Setup
var failureMechanism = new TestFailureMechanism();
- var mockRepository = new MockRepository();
+ var mocks = new MockRepository();
IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism,
- mockRepository);
+ mocks);
var calculator = new TestStructuresCalculator();
- var calculatorFactory = mockRepository.StrictMock();
+ var calculatorFactory = mocks.StrictMock();
calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath))
.Return(calculator);
- mockRepository.ReplayAll();
+ mocks.ReplayAll();
var calculation = new TestStructuresCalculation
{
@@ -467,37 +459,248 @@
// Call
service.Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ new GeneralTestInput(),
+ 0,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
Assert.IsNull(calculation.Output);
Assert.IsTrue(calculator.IsCanceled);
}
- mockRepository.VerifyAll();
+ mocks.VerifyAll();
}
+ [Test]
+ public void Calculate_CalculationFailedWithExceptionAndLastErrorPresent_LogErrorAndThrowException()
+ {
+ // Setup
+ var failureMechanism = new TestFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("test section", new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }));
+
+ var generalInput = new GeneralTestInput();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism,
+ mocks);
+ var calculator = new TestStructuresCalculator
+ {
+ LastErrorFileContent = "An error occurred",
+ EndInFailure = true
+ };
+ var calculatorFactory = mocks.StrictMock();
+ calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath))
+ .Return(calculator);
+ mocks.ReplayAll();
+
+ var calculation = new TestStructuresCalculation
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = assessmentSectionStub.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001)
+ }
+ };
+
+ using (new HydraRingCalculatorFactoryConfig(calculatorFactory))
+ {
+ var exceptionThrown = false;
+
+ // Call
+ Action call = () =>
+ {
+ try
+ {
+ new TestStructuresCalculationService(new TestMessageProvider()).Calculate(calculation,
+ generalInput,
+ generalInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
+ validFilePath);
+ }
+ catch (HydraRingCalculationException)
+ {
+ exceptionThrown = true;
+ }
+ };
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ string[] msgs = messages.ToArray();
+ Assert.AreEqual(4, msgs.Length);
+ CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]);
+ Assert.AreEqual($"Calculation '{calculation.Name}' failed with report 'An error occurred'.", msgs[1]);
+ Assert.AreEqual("Calculation performed in directory ''.", msgs[2]);
+ CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]);
+ });
+ Assert.IsTrue(exceptionThrown);
+ Assert.IsNull(calculation.Output);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Calculate_CalculationFailedWithExceptionAndNoLastErrorPresent_LogErrorAndThrowException()
+ {
+ // Setup
+ var failureMechanism = new TestFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("test section", new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }));
+
+ var generalInput = new GeneralTestInput();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism,
+ mocks);
+ var calculator = new TestStructuresCalculator
+ {
+ EndInFailure = true
+ };
+ var calculatorFactory = mocks.StrictMock();
+ calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath))
+ .Return(calculator);
+ mocks.ReplayAll();
+
+ var calculation = new TestStructuresCalculation
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = assessmentSectionStub.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001)
+ }
+ };
+
+ using (new HydraRingCalculatorFactoryConfig(calculatorFactory))
+ {
+ var exceptionThrown = false;
+
+ // Call
+ Action call = () =>
+ {
+ try
+ {
+ new TestStructuresCalculationService(new TestMessageProvider()).Calculate(calculation,
+ generalInput,
+ generalInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
+ validFilePath);
+ }
+ catch (HydraRingCalculationException)
+ {
+ exceptionThrown = true;
+ }
+ };
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ string[] msgs = messages.ToArray();
+ Assert.AreEqual(4, msgs.Length);
+ CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]);
+ Assert.AreEqual($"Calculation '{calculation.Name}' failed.", msgs[1]);
+ StringAssert.StartsWith("Calculation performed in directory ''", msgs[2]);
+ CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]);
+ });
+ Assert.IsTrue(exceptionThrown);
+ Assert.IsNull(calculation.Output);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Calculate_CalculationFailedWithoutExceptionAndWithLastErrorPresent_LogErrorAndThrowException()
+ {
+ // Setup
+ var failureMechanism = new TestFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("test section", new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }));
+
+ var generalInput = new GeneralTestInput();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism,
+ mocks);
+ var calculator = new TestStructuresCalculator
+ {
+ EndInFailure = false,
+ LastErrorFileContent = "An error occurred"
+ };
+ var calculatorFactory = mocks.StrictMock();
+ calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath))
+ .Return(calculator);
+ mocks.ReplayAll();
+
+ var calculation = new TestStructuresCalculation
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = assessmentSectionStub.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001)
+ }
+ };
+
+ using (new HydraRingCalculatorFactoryConfig(calculatorFactory))
+ {
+ var exceptionThrown = false;
+ string exceptionMessage = string.Empty;
+
+ // Call
+ Action call = () =>
+ {
+ try
+ {
+ new TestStructuresCalculationService(new TestMessageProvider()).Calculate(calculation,
+ generalInput,
+ generalInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
+ validFilePath);
+ }
+ catch (HydraRingCalculationException e)
+ {
+ exceptionThrown = true;
+ exceptionMessage = e.Message;
+ }
+ };
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ string[] msgs = messages.ToArray();
+ Assert.AreEqual(4, msgs.Length);
+ CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]);
+ StringAssert.StartsWith($"Calculation '{calculation.Name}' failed with report 'An error occurred'.", msgs[1]);
+ StringAssert.StartsWith("Calculation performed in directory ''", msgs[2]);
+ CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]);
+ });
+ Assert.IsTrue(exceptionThrown);
+ Assert.IsNull(calculation.Output);
+ Assert.AreEqual(calculator.LastErrorFileContent, exceptionMessage);
+ }
+ mocks.VerifyAll();
+ }
+
private class TestStructuresCalculationService : StructuresCalculationServiceBase
+ TestStructuresInput, TestStructure, GeneralTestInput, ExceedanceProbabilityCalculationInput>
{
public TestStructuresCalculationService(IStructuresCalculationMessageProvider messageProvider) : base(messageProvider) {}
protected override ExceedanceProbabilityCalculationInput CreateInput(StructuresCalculation calculation,
- TestFailureMechanism failureMechanism,
+ GeneralTestInput generalInput,
string hydraulicBoundaryDatabaseFilePath)
{
return new TestExceedanceProbabilityCalculationInput(calculation.InputParameters.HydraulicBoundaryLocation.Id);
}
-
- protected override void PerformCalculation(IStructuresCalculator calculator,
- ExceedanceProbabilityCalculationInput input,
- StructuresCalculation calculation,
- IAssessmentSection assessmentSection,
- TestFailureMechanism failureMechanism)
- {
- calculator.Calculate(input);
- }
}
private class TestExceedanceProbabilityCalculationInput : ExceedanceProbabilityCalculationInput
@@ -521,18 +724,29 @@
{
public string GetCalculationFailedMessage(string calculationSubject)
{
- return $"Calculation {calculationSubject} failed.";
+ return $"Calculation '{calculationSubject}' failed.";
}
public string GetCalculationFailedWithErrorReportMessage(string calculationSubject, string errorReport)
{
- return $"Calculation {calculationSubject} failed with report {errorReport}.";
+ return $"Calculation '{calculationSubject}' failed with report '{errorReport}'.";
}
- public string GetCalculationPerformedMessage(string calculationSubject)
+ public string GetCalculationPerformedMessage(string outputDirectory)
{
- return $"Calculation {calculationSubject} performed.";
+ return $"Calculation performed in directory '{outputDirectory}'.";
}
}
+
+ private class GeneralTestInput
+ {
+ public double N
+ {
+ get
+ {
+ return 0;
+ }
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationActivity.cs
===================================================================
diff -u -r76948e8765899b35776102ecd211d3d7575a9e4d -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationActivity.cs (.../HeightStructuresCalculationActivity.cs) (revision 76948e8765899b35776102ecd211d3d7575a9e4d)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationActivity.cs (.../HeightStructuresCalculationActivity.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -88,8 +88,10 @@
calculation.ClearOutput();
calculationService.Calculate(calculation,
- assessmentSection,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSection.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
hydraulicBoundaryDatabaseFilePath);
}
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationMessageProvider.cs
===================================================================
diff -u -r461842cc9a0a60d00900065b9a7db474db7d7548 -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationMessageProvider.cs (.../HeightStructuresCalculationMessageProvider.cs) (revision 461842cc9a0a60d00900065b9a7db474db7d7548)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationMessageProvider.cs (.../HeightStructuresCalculationMessageProvider.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -41,10 +41,10 @@
calculationSubject, errorReport);
}
- public string GetCalculationPerformedMessage(string calculationSubject)
+ public string GetCalculationPerformedMessage(string outputDirectory)
{
return string.Format(Resources.HeightStructuresCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0,
- calculationSubject);
+ outputDirectory);
}
}
}
\ No newline at end of file
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationService.cs
===================================================================
diff -u -r6e0a4fb94b3cd5631842025c95d2b1460fc7a6ce -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationService.cs (.../HeightStructuresCalculationService.cs) (revision 6e0a4fb94b3cd5631842025c95d2b1460fc7a6ce)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresCalculationService.cs (.../HeightStructuresCalculationService.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -19,40 +19,30 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using log4net;
-using Ringtoets.Common.Data.AssessmentSection;
-using Ringtoets.Common.Data.Probability;
using Ringtoets.Common.Data.Structures;
using Ringtoets.Common.Service;
-using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.Common.Service.Structures;
using Ringtoets.HeightStructures.Data;
-using Ringtoets.HeightStructures.Service.Properties;
-using Ringtoets.HydraRing.Calculation.Calculator;
using Ringtoets.HydraRing.Calculation.Data.Input.Structures;
-using Ringtoets.HydraRing.Calculation.Exceptions;
namespace Ringtoets.HeightStructures.Service
{
///
/// Service that provides methods for performing Hydra-Ring calculations for height structures.
///
public class HeightStructuresCalculationService : StructuresCalculationServiceBase
- {
- private static readonly ILog log = LogManager.GetLogger(typeof(HeightStructuresCalculationService));
+ HeightStructure, GeneralHeightStructuresInput, StructuresOvertoppingCalculationInput>
+ {
///
/// Creates a new instance of .
///
public HeightStructuresCalculationService() : base(new HeightStructuresCalculationMessageProvider()) {}
protected override StructuresOvertoppingCalculationInput CreateInput(StructuresCalculation calculation,
- HeightStructuresFailureMechanism failureMechanism,
+ GeneralHeightStructuresInput generalInput,
string hydraulicBoundaryDatabaseFilePath)
{
- GeneralHeightStructuresInput generalInput = failureMechanism.GeneralInput;
-
var structuresOvertoppingCalculationInput = new StructuresOvertoppingCalculationInput(
calculation.InputParameters.HydraulicBoundaryLocation.Id,
calculation.InputParameters.StructureNormalOrientation,
@@ -78,67 +68,5 @@
return structuresOvertoppingCalculationInput;
}
-
- protected override void PerformCalculation(IStructuresCalculator calculator,
- StructuresOvertoppingCalculationInput input,
- StructuresCalculation calculation,
- IAssessmentSection assessmentSection,
- HeightStructuresFailureMechanism failureMechanism)
- {
- var exceptionThrown = false;
-
- try
- {
- calculator.Calculate(input);
-
- if (!Canceled && string.IsNullOrEmpty(calculator.LastErrorFileContent))
- {
- ProbabilityAssessmentOutput probabilityAssessmentOutput =
- ProbabilityAssessmentService.Calculate(assessmentSection.FailureMechanismContribution.Norm,
- failureMechanism.Contribution,
- failureMechanism.GeneralInput.N,
- calculator.ExceedanceProbabilityBeta);
- calculation.Output = new StructuresOutput(probabilityAssessmentOutput);
- }
- }
- catch (HydraRingCalculationException)
- {
- if (!Canceled)
- {
- string lastErrorContent = calculator.LastErrorFileContent;
- if (string.IsNullOrEmpty(lastErrorContent))
- {
- log.ErrorFormat(Resources.HeightStructuresCalculationService_Calculate_Error_in_HeightStructuresCalculation_0_no_error_report,
- calculation.Name);
- }
- else
- {
- log.ErrorFormat(Resources.HeightStructuresCalculationService_Calculate_Error_in_HeightStructuresCalculation_0_click_details_for_last_error_report_1,
- calculation.Name, lastErrorContent);
- }
-
- exceptionThrown = true;
- throw;
- }
- }
- finally
- {
- string lastErrorFileContent = calculator.LastErrorFileContent;
- bool errorOccurred = CalculationServiceHelper.HasErrorOccurred(Canceled, exceptionThrown, lastErrorFileContent);
- if (errorOccurred)
- {
- log.ErrorFormat(Resources.HeightStructuresCalculationService_Calculate_Error_in_HeightStructuresCalculation_0_click_details_for_last_error_report_1,
- calculation.Name, lastErrorFileContent);
- }
-
- log.InfoFormat(Resources.HeightStructuresCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0, calculator.OutputDirectory);
- CalculationServiceHelper.LogCalculationEnd();
-
- if (errorOccurred)
- {
- throw new HydraRingCalculationException(lastErrorFileContent);
- }
- }
- }
}
}
\ No newline at end of file
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresCalculationMessageProviderTest.cs
===================================================================
diff -u -r461842cc9a0a60d00900065b9a7db474db7d7548 -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresCalculationMessageProviderTest.cs (.../HeightStructuresCalculationMessageProviderTest.cs) (revision 461842cc9a0a60d00900065b9a7db474db7d7548)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresCalculationMessageProviderTest.cs (.../HeightStructuresCalculationMessageProviderTest.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -78,16 +78,16 @@
[TestCase(null)]
[TestCase("")]
[TestCase("value")]
- public void GetCalculationPerformedMessage_VariousParameters_ReturnsExpectedValue(string name)
+ public void GetCalculationPerformedMessage_VariousParameters_ReturnsExpectedValue(string directory)
{
// Setup
var provider = new HeightStructuresCalculationMessageProvider();
// Call
- string message = provider.GetCalculationPerformedMessage(name);
+ string message = provider.GetCalculationPerformedMessage(directory);
// Assert
- string expectedMessage = $"Hoogte kunstwerk berekening is uitgevoerd op de tijdelijke locatie '{name}'. " +
+ string expectedMessage = $"Hoogte kunstwerk berekening is uitgevoerd op de tijdelijke locatie '{directory}'. " +
"Gedetailleerde invoer en uitvoer kan in de bestanden op deze locatie worden gevonden.";
Assert.AreEqual(expectedMessage, message);
}
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresCalculationServiceTest.cs
===================================================================
diff -u -rfa05755175660f1738a1c3bf82fb4505b93ffa1f -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresCalculationServiceTest.cs (.../HeightStructuresCalculationServiceTest.cs) (revision fa05755175660f1738a1c3bf82fb4505b93ffa1f)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Service.Test/HeightStructuresCalculationServiceTest.cs (.../HeightStructuresCalculationServiceTest.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -60,7 +60,7 @@
// Assert
Assert.IsInstanceOf>(service);
+ HeightStructure, GeneralHeightStructuresInput, StructuresOvertoppingCalculationInput>>(service);
}
[Test]
@@ -384,15 +384,15 @@
public void Calculate_ValidCalculationInputAndForeshoreWithValidBreakWater_LogStartAndEndAndReturnOutput(CalculationType calculationType)
{
// Setup
- var heightStructuresFailureMechanism = new HeightStructuresFailureMechanism();
- heightStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[]
+ var failureMechanism = new HeightStructuresFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("test section", new[]
{
new Point2D(0, 0),
new Point2D(1, 1)
}));
var mockRepository = new MockRepository();
- IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(heightStructuresFailureMechanism, mockRepository);
+ IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository);
var calculatorFactory = mockRepository.StrictMock();
calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath))
@@ -429,8 +429,10 @@
using (new HydraRingCalculatorFactoryConfig(calculatorFactory))
{
Action call = () => new HeightStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- heightStructuresFailureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
@@ -456,15 +458,15 @@
public void Calculate_ValidCalculationInputAndForeshoreWithInvalidBreakWater_LogStartAndEndAndReturnOutput(double height)
{
// Setup
- var heightStructuresFailureMechanism = new HeightStructuresFailureMechanism();
- heightStructuresFailureMechanism.AddSection(new FailureMechanismSection("test section", new[]
+ var failureMechanism = new HeightStructuresFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("test section", new[]
{
new Point2D(0, 0),
new Point2D(1, 1)
}));
var mockRepository = new MockRepository();
- IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(heightStructuresFailureMechanism, mockRepository);
+ IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository);
var calculatorFactory = mockRepository.StrictMock();
calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(testDataPath))
@@ -486,8 +488,10 @@
using (new HydraRingCalculatorFactoryConfig(calculatorFactory))
{
Action call = () => new HeightStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- heightStructuresFailureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
@@ -511,10 +515,10 @@
public void Calculate_VariousCalculations_InputPropertiesCorrectlySentToCalculator(bool useForeshore, bool useBreakWater)
{
// Setup
- var heightStructuresFailureMechanism = new HeightStructuresFailureMechanism();
+ var failureMechanism = new HeightStructuresFailureMechanism();
var mockRepository = new MockRepository();
- IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(heightStructuresFailureMechanism, mockRepository);
+ IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository);
var calculator = new TestStructuresCalculator();
var calculatorFactory = mockRepository.StrictMock();
@@ -539,15 +543,17 @@
{
// Call
new HeightStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- heightStructuresFailureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
StructuresOvertoppingCalculationInput[] overtoppingCalculationInputs = calculator.ReceivedInputs.ToArray();
Assert.AreEqual(1, overtoppingCalculationInputs.Length);
- GeneralHeightStructuresInput generalInput = heightStructuresFailureMechanism.GeneralInput;
+ GeneralHeightStructuresInput generalInput = failureMechanism.GeneralInput;
HeightStructuresInput input = calculation.InputParameters;
var expectedInput = new StructuresOvertoppingCalculationInput(
1300001,
@@ -620,8 +626,10 @@
try
{
new HeightStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
}
catch (HydraRingCalculationException)
@@ -688,8 +696,10 @@
try
{
new HeightStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
}
catch (HydraRingCalculationException)
@@ -757,8 +767,10 @@
try
{
new HeightStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
}
catch (HydraRingCalculationException e)
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresCalculationActivity.cs
===================================================================
diff -u -r76948e8765899b35776102ecd211d3d7575a9e4d -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresCalculationActivity.cs (.../StabilityPointStructuresCalculationActivity.cs) (revision 76948e8765899b35776102ecd211d3d7575a9e4d)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresCalculationActivity.cs (.../StabilityPointStructuresCalculationActivity.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -91,8 +91,10 @@
calculation.ClearOutput();
calculationService.Calculate(calculation,
- assessmentSection,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSection.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
hydraulicBoundaryDatabaseFilePath);
}
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresCalculationMessageProvider.cs
===================================================================
diff -u -r461842cc9a0a60d00900065b9a7db474db7d7548 -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresCalculationMessageProvider.cs (.../StabilityPointStructuresCalculationMessageProvider.cs) (revision 461842cc9a0a60d00900065b9a7db474db7d7548)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresCalculationMessageProvider.cs (.../StabilityPointStructuresCalculationMessageProvider.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -41,10 +41,10 @@
calculationSubject, errorReport);
}
- public string GetCalculationPerformedMessage(string calculationSubject)
+ public string GetCalculationPerformedMessage(string outputDirectory)
{
return string.Format(Resources.StabilityPointStructuresCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0,
- calculationSubject);
+ outputDirectory);
}
}
}
\ No newline at end of file
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresCalculationService.cs
===================================================================
diff -u -r6e0a4fb94b3cd5631842025c95d2b1460fc7a6ce -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresCalculationService.cs (.../StabilityPointStructuresCalculationService.cs) (revision 6e0a4fb94b3cd5631842025c95d2b1460fc7a6ce)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Service/StabilityPointStructuresCalculationService.cs (.../StabilityPointStructuresCalculationService.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -20,18 +20,11 @@
// All rights reserved.
using System.ComponentModel;
-using log4net;
-using Ringtoets.Common.Data.AssessmentSection;
-using Ringtoets.Common.Data.Probability;
using Ringtoets.Common.Data.Structures;
using Ringtoets.Common.Service;
-using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.Common.Service.Structures;
-using Ringtoets.HydraRing.Calculation.Calculator;
using Ringtoets.HydraRing.Calculation.Data.Input.Structures;
-using Ringtoets.HydraRing.Calculation.Exceptions;
using Ringtoets.StabilityPointStructures.Data;
-using Ringtoets.StabilityPointStructures.Service.Properties;
namespace Ringtoets.StabilityPointStructures.Service
{
@@ -41,18 +34,16 @@
public class StabilityPointStructuresCalculationService : StructuresCalculationServiceBase
{
- private static readonly ILog log = LogManager.GetLogger(typeof(StabilityPointStructuresCalculationService));
-
///
/// Creates a new instance of .
///
public StabilityPointStructuresCalculationService() : base(new StabilityPointStructuresCalculationMessageProvider()) {}
protected override StructuresStabilityPointCalculationInput CreateInput(StructuresCalculation calculation,
- StabilityPointStructuresFailureMechanism failureMechanism,
+ GeneralStabilityPointStructuresInput generalInput,
string hydraulicBoundaryDatabaseFilePath)
{
StructuresStabilityPointCalculationInput input;
@@ -64,12 +55,12 @@
case LoadSchematizationType.Linear:
input = CreateLowSillLinearCalculationInput(
calculation,
- failureMechanism.GeneralInput);
+ generalInput);
break;
case LoadSchematizationType.Quadratic:
input = CreateLowSillQuadraticCalculationInput(
calculation,
- failureMechanism.GeneralInput);
+ generalInput);
break;
default:
throw new InvalidEnumArgumentException(nameof(calculation),
@@ -83,12 +74,12 @@
case LoadSchematizationType.Linear:
input = CreateFloodedCulvertLinearCalculationInput(
calculation,
- failureMechanism.GeneralInput);
+ generalInput);
break;
case LoadSchematizationType.Quadratic:
input = CreateFloodedCulvertQuadraticCalculationInput(
calculation,
- failureMechanism.GeneralInput);
+ generalInput);
break;
default:
throw new InvalidEnumArgumentException(nameof(calculation),
@@ -106,67 +97,6 @@
return input;
}
- protected override void PerformCalculation(IStructuresCalculator calculator,
- StructuresStabilityPointCalculationInput input,
- StructuresCalculation calculation,
- IAssessmentSection assessmentSection,
- StabilityPointStructuresFailureMechanism failureMechanism)
- {
- var exceptionThrown = false;
- try
- {
- calculator.Calculate(input);
-
- if (!Canceled && string.IsNullOrEmpty(calculator.LastErrorFileContent))
- {
- ProbabilityAssessmentOutput probabilityAssessmentOutput =
- ProbabilityAssessmentService.Calculate(assessmentSection.FailureMechanismContribution.Norm,
- failureMechanism.Contribution,
- failureMechanism.GeneralInput.N,
- calculator.ExceedanceProbabilityBeta);
- calculation.Output = new StructuresOutput(probabilityAssessmentOutput);
- }
- }
- catch (HydraRingCalculationException)
- {
- if (!Canceled)
- {
- string lastErrorContent = calculator.LastErrorFileContent;
- if (string.IsNullOrEmpty(lastErrorContent))
- {
- log.ErrorFormat(Resources.StabilityPointStructuresCalculationService_Calculate_Error_in_StabilityPointStructuresCalculation_0_no_error_report,
- calculation.Name);
- }
- else
- {
- log.ErrorFormat(Resources.StabilityPointStructuresCalculationService_Calculate_Error_in_StabilityPointStructuresCalculation_0_click_details_for_last_error_report_1,
- calculation.Name, lastErrorContent);
- }
-
- exceptionThrown = true;
- throw;
- }
- }
- finally
- {
- string lastErrorFileContent = calculator.LastErrorFileContent;
- bool errorOccurred = CalculationServiceHelper.HasErrorOccurred(Canceled, exceptionThrown, lastErrorFileContent);
- if (errorOccurred)
- {
- log.ErrorFormat(Resources.StabilityPointStructuresCalculationService_Calculate_Error_in_StabilityPointStructuresCalculation_0_click_details_for_last_error_report_1,
- calculation.Name, lastErrorFileContent);
- }
-
- log.InfoFormat(Resources.StabilityPointStructuresCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0, calculator.OutputDirectory);
- CalculationServiceHelper.LogCalculationEnd();
-
- if (errorOccurred)
- {
- throw new HydraRingCalculationException(lastErrorFileContent);
- }
- }
- }
-
private StructuresStabilityPointLowSillLinearCalculationInput CreateLowSillLinearCalculationInput(StructuresCalculation calculation,
GeneralStabilityPointStructuresInput generalInput)
{
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationMessageProviderTest.cs
===================================================================
diff -u -r461842cc9a0a60d00900065b9a7db474db7d7548 -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationMessageProviderTest.cs (.../StabilityPointStructuresCalculationMessageProviderTest.cs) (revision 461842cc9a0a60d00900065b9a7db474db7d7548)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationMessageProviderTest.cs (.../StabilityPointStructuresCalculationMessageProviderTest.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -78,16 +78,16 @@
[TestCase(null)]
[TestCase("")]
[TestCase("value")]
- public void GetCalculationPerformedMessage_VariousParameters_ReturnsExpectedValue(string name)
+ public void GetCalculationPerformedMessage_VariousParameters_ReturnsExpectedValue(string directory)
{
// Setup
var provider = new StabilityPointStructuresCalculationMessageProvider();
// Call
- string message = provider.GetCalculationPerformedMessage(name);
+ string message = provider.GetCalculationPerformedMessage(directory);
// Assert
- string expectedMessage = $"Puntconstructies berekening is uitgevoerd op de tijdelijke locatie '{name}'. " +
+ string expectedMessage = $"Puntconstructies berekening is uitgevoerd op de tijdelijke locatie '{directory}'. " +
"Gedetailleerde invoer en uitvoer kan in de bestanden op deze locatie worden gevonden.";
Assert.AreEqual(expectedMessage, message);
}
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationServiceTest.cs
===================================================================
diff -u -rfa05755175660f1738a1c3bf82fb4505b93ffa1f -rf71fb2faaae836236b85a1c3a4483f6aee4f4d88
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationServiceTest.cs (.../StabilityPointStructuresCalculationServiceTest.cs) (revision fa05755175660f1738a1c3bf82fb4505b93ffa1f)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Service.Test/StabilityPointStructuresCalculationServiceTest.cs (.../StabilityPointStructuresCalculationServiceTest.cs) (revision f71fb2faaae836236b85a1c3a4483f6aee4f4d88)
@@ -61,7 +61,7 @@
Assert.IsInstanceOf>(service);
}
@@ -549,7 +549,8 @@
}));
var mockRepository = new MockRepository();
- var assessmentSectionStub = mockRepository.Stub();
+ IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism,
+ mockRepository);
var calculatorFactory = mockRepository.StrictMock();
mockRepository.ReplayAll();
@@ -568,9 +569,11 @@
{
// Call
TestDelegate call = () => service.Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
- testDataPath);
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
+ validFilePath);
// Assert
const string expectedMessage = "The value of argument 'calculation' (100) is invalid for Enum type 'StabilityPointStructureInflowModelType'.";
@@ -595,7 +598,8 @@
}));
var mockRepository = new MockRepository();
- var assessmentSectionStub = mockRepository.Stub();
+ IAssessmentSection assessmentSectionStub = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism,
+ mockRepository);
var calculatorFactory = mockRepository.StrictMock();
mockRepository.ReplayAll();
@@ -614,9 +618,11 @@
{
// Call
TestDelegate call = () => service.Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
- testDataPath);
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
+ validFilePath);
// Assert
const string expectedMessage = "The value of argument 'calculation' (100) is invalid for Enum type 'LoadSchematizationType'.";
@@ -664,8 +670,10 @@
{
// Call
new StabilityPointStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
@@ -783,8 +791,10 @@
{
// Call
new StabilityPointStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
@@ -902,8 +912,10 @@
{
// Call
new StabilityPointStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
@@ -1021,8 +1033,10 @@
{
// Call
new StabilityPointStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
@@ -1158,8 +1172,10 @@
using (new HydraRingCalculatorFactoryConfig(calculatorFactory))
{
Action call = () => new StabilityPointStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
// Assert
@@ -1220,8 +1236,10 @@
try
{
new StabilityPointStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
}
catch (HydraRingCalculationException)
@@ -1287,8 +1305,10 @@
try
{
new StabilityPointStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
}
catch (HydraRingCalculationException)
@@ -1355,8 +1375,10 @@
try
{
new StabilityPointStructuresCalculationService().Calculate(calculation,
- assessmentSectionStub,
- failureMechanism,
+ failureMechanism.GeneralInput,
+ failureMechanism.GeneralInput.N,
+ assessmentSectionStub.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution,
validFilePath);
}
catch (HydraRingCalculationException e)