Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Structures/StructuresClosureCalculationInput.cs
===================================================================
diff -u -rff02e836fe80bdeaadf7fb4c2e3d86f2a3c3c372 -rac36424e0dc0a1df15bdc91e107e5f13fd4c2369
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Structures/StructuresClosureCalculationInput.cs (.../StructuresClosureCalculationInput.cs) (revision ff02e836fe80bdeaadf7fb4c2e3d86f2a3c3c372)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Structures/StructuresClosureCalculationInput.cs (.../StructuresClosureCalculationInput.cs) (revision ac36424e0dc0a1df15bdc91e107e5f13fd4c2369)
@@ -26,11 +26,18 @@
///
public class StructuresClosureCalculationInput : ExceedanceProbabilityCalculationInput
{
+ private readonly HydraRingSection hydraRingSection;
+
///
/// Creates a new instance of .
///
/// The id of the hydraulic station to use during the calculation.
- public StructuresClosureCalculationInput(long hydraulicBoundaryLocationId) : base(hydraulicBoundaryLocationId) {}
+ /// The section to use during the calculation.
+ public StructuresClosureCalculationInput(long hydraulicBoundaryLocationId, HydraRingSection hydraRingSection)
+ : base(hydraulicBoundaryLocationId)
+ {
+ this.hydraRingSection = hydraRingSection;
+ }
public override HydraRingFailureMechanismType FailureMechanismType
{
@@ -52,8 +59,21 @@
{
get
{
- throw new System.NotImplementedException();
+ return hydraRingSection;
}
}
+
+ public override int? GetSubMechanismModelId(int subMechanismId)
+ {
+ switch (subMechanismId)
+ {
+ case 424:
+ return 106;
+ case 425:
+ return 111;
+ default:
+ return null;
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureCalculationInputTest.cs
===================================================================
diff -u -rff02e836fe80bdeaadf7fb4c2e3d86f2a3c3c372 -rac36424e0dc0a1df15bdc91e107e5f13fd4c2369
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureCalculationInputTest.cs (.../StructuresClosureCalculationInputTest.cs) (revision ff02e836fe80bdeaadf7fb4c2e3d86f2a3c3c372)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureCalculationInputTest.cs (.../StructuresClosureCalculationInputTest.cs) (revision ac36424e0dc0a1df15bdc91e107e5f13fd4c2369)
@@ -34,16 +34,32 @@
{
// Setup
const int hydraulicBoundaryLocationId = 1000;
+ var hydraRingSection = new HydraRingSection(1, double.NaN, double.NaN);
// Call
- var input = new StructuresClosureCalculationInput(hydraulicBoundaryLocationId);
+ var input = new StructuresClosureCalculationInput(hydraulicBoundaryLocationId, hydraRingSection);
// Assert
Assert.IsInstanceOf(input);
Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId);
Assert.AreEqual(1, input.CalculationTypeId);
Assert.AreEqual(65, input.VariableId);
Assert.AreEqual(HydraRingFailureMechanismType.StructuresClosure, input.FailureMechanismType);
+ Assert.AreSame(hydraRingSection, input.Section);
}
+
+ [Test]
+ [TestCase(423, null)]
+ [TestCase(424, 106)]
+ [TestCase(425, 111)]
+ [TestCase(426, null)]
+ public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId)
+ {
+ // Call
+ var input = new StructuresClosureCalculationInput(1, new HydraRingSection(1, double.NaN, double.NaN));
+
+ // Assert
+ Assert.AreEqual(expectedSubMechanismModelId, input.GetSubMechanismModelId(subMechanismModelId));
+ }
}
}
\ No newline at end of file