Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanDrainageConstruction.cs
===================================================================
diff -u -r82014e97419537804be86264d0ed501637ccd10f -rf41767008e9489269fcd67a0a60608d8ddb8ac13
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanDrainageConstruction.cs (.../UpliftVanDrainageConstruction.cs) (revision 82014e97419537804be86264d0ed501637ccd10f)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.KernelWrapper/Calculators/UpliftVan/Input/UpliftVanDrainageConstruction.cs (.../UpliftVanDrainageConstruction.cs) (revision f41767008e9489269fcd67a0a60608d8ddb8ac13)
@@ -39,7 +39,7 @@
}
///
- /// Creates a new instance of
+ /// Creates a new instance of .
///
/// The x coordinate of the drainage construction.
/// The z coordinate of the drainage construction.
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/Input/StabilityLocationCreatorTest.cs
===================================================================
diff -u -rc50841e1e3dbc1e2759861f906058645e19b2a01 -rf41767008e9489269fcd67a0a60608d8ddb8ac13
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/Input/StabilityLocationCreatorTest.cs (.../StabilityLocationCreatorTest.cs) (revision c50841e1e3dbc1e2759861f906058645e19b2a01)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Creators/Input/StabilityLocationCreatorTest.cs (.../StabilityLocationCreatorTest.cs) (revision f41767008e9489269fcd67a0a60608d8ddb8ac13)
@@ -198,7 +198,9 @@
}
[Test]
- public void Create_WithInput_ReturnStabilityLocation()
+ [Combinatorial]
+ public void Create_WithInput_ReturnStabilityLocation([Values(true, false)] bool drainageConstructionPresent,
+ [Values(true, false)] bool useDefaultOffsets)
{
// Setup
var random = new Random(21);
@@ -222,8 +224,14 @@
double piezometricHeadPhreaticLine2Inwards = random.Next();
double penetrationLength = random.Next();
- var drainageConstruction = new UpliftVanDrainageConstruction(xCoordinateDrainageConstruction, zCoordinateDrainageConstruction);
- var phreaticLineOffsets = new UpliftVanPhreaticLineOffsets(phreaticLineOffsetBelowDikeTopAtRiver, phreaticLineOffsetBelowDikeTopAtPolder,
+ UpliftVanDrainageConstruction drainageConstruction = drainageConstructionPresent
+ ? new UpliftVanDrainageConstruction(
+ xCoordinateDrainageConstruction, zCoordinateDrainageConstruction)
+ : new UpliftVanDrainageConstruction();
+ UpliftVanPhreaticLineOffsets phreaticLineOffsets = useDefaultOffsets
+ ? new UpliftVanPhreaticLineOffsets()
+ : new UpliftVanPhreaticLineOffsets(
+ phreaticLineOffsetBelowDikeTopAtRiver, phreaticLineOffsetBelowDikeTopAtPolder,
phreaticLineOffsetBelowDikeToeAtPolder, phreaticLineOffsetBelowShoulderBaseInside);
var input = new UpliftVanCalculatorInput(
@@ -232,7 +240,7 @@
SurfaceLine = new MacroStabilityInwardsSurfaceLine("test"),
SoilProfile = new TestUpliftVanSoilProfile(),
SlipPlane = new UpliftVanSlipPlane(),
- DikeSoilScenario = MacroStabilityInwardsDikeSoilScenario.ClayDikeOnClay,
+ DikeSoilScenario = MacroStabilityInwardsDikeSoilScenario.SandDikeOnClay,
AssessmentLevel = assessmentLevel,
WaterLevelRiverAverage = waterLevelRiverAverage,
WaterLevelPolder = waterLevelPolder,
@@ -254,23 +262,24 @@
StabilityLocation location = StabilityLocationCreator.Create(input);
// Assert
- Assert.AreEqual(DikeSoilScenario.ClayDikeOnClay, location.DikeSoilScenario);
+ Assert.AreEqual(DikeSoilScenario.SandDikeOnClay, location.DikeSoilScenario);
Assert.AreEqual(WaternetCreationMode.CreateWaternet, location.WaternetCreationMode);
Assert.AreEqual(PlLineCreationMethod.RingtoetsWti2017, location.PlLineCreationMethod);
Assert.AreEqual(assessmentLevel, location.WaterLevelRiver);
Assert.AreEqual(assessmentLevel, location.HeadInPlLine3);
Assert.AreEqual(assessmentLevel, location.HeadInPlLine4);
Assert.AreEqual(waterLevelRiverAverage, location.WaterLevelRiverAverage);
Assert.AreEqual(waterLevelPolder, location.WaterLevelPolder);
- Assert.AreEqual(xCoordinateDrainageConstruction, location.XCoordMiddleDrainageConstruction);
- Assert.AreEqual(zCoordinateDrainageConstruction, location.ZCoordMiddleDrainageConstruction);
+ Assert.AreEqual(drainageConstruction.IsPresent, location.DrainageConstructionPresent);
+ Assert.AreEqual(drainageConstruction.XCoordinate, location.XCoordMiddleDrainageConstruction);
+ Assert.AreEqual(drainageConstruction.ZCoordinate, location.ZCoordMiddleDrainageConstruction);
Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopRiver, location.MinimumLevelPhreaticLineAtDikeTopRiver);
Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopPolder, location.MinimumLevelPhreaticLineAtDikeTopPolder);
- Assert.IsFalse(location.UseDefaultOffsets);
- Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtRiver, location.PlLineOffsetBelowPointBRingtoetsWti2017);
- Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtPolder, location.PlLineOffsetBelowDikeTopAtPolder);
- Assert.AreEqual(phreaticLineOffsetBelowShoulderBaseInside, location.PlLineOffsetBelowShoulderBaseInside);
- Assert.AreEqual(phreaticLineOffsetBelowDikeToeAtPolder, location.PlLineOffsetBelowDikeToeAtPolder);
+ Assert.AreEqual(phreaticLineOffsets.UseDefaults, location.UseDefaultOffsets);
+ Assert.AreEqual(phreaticLineOffsets.BelowDikeTopAtRiver, location.PlLineOffsetBelowPointBRingtoetsWti2017);
+ Assert.AreEqual(phreaticLineOffsets.BelowDikeTopAtPolder, location.PlLineOffsetBelowDikeTopAtPolder);
+ Assert.AreEqual(phreaticLineOffsets.BelowShoulderBaseInside, location.PlLineOffsetBelowShoulderBaseInside);
+ Assert.AreEqual(phreaticLineOffsets.BelowDikeToeAtPolder, location.PlLineOffsetBelowDikeToeAtPolder);
Assert.AreEqual(adjustPhreaticLine3And4ForUplift, location.AdjustPl3And4ForUplift);
Assert.AreEqual(leakageLengthOutwardsPhreaticLine3, location.LeakageLengthOutwardsPl3);
Assert.AreEqual(leakageLengthInwardsPhreaticLine3, location.LeakageLengthInwardsPl3);
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs
===================================================================
diff -u -r0972b795d89686b6ae07a1b256fc2db51f524c9f -rf41767008e9489269fcd67a0a60608d8ddb8ac13
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision 0972b795d89686b6ae07a1b256fc2db51f524c9f)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision f41767008e9489269fcd67a0a60608d8ddb8ac13)
@@ -477,7 +477,7 @@
// Assert
UpliftVanCalculatorInput actualInput = ((TestMacroStabilityInwardsCalculatorFactory) MacroStabilityInwardsCalculatorFactory.Instance)
.LastCreatedUpliftVanCalculator.Input;
- Assert.IsFalse(actualInput.DrainageConstruction.IsPresent);
+ Assert.IsTrue(actualInput.PhreaticLineOffsets.UseDefaults);
Assert.IsNaN(actualInput.PhreaticLineOffsets.BelowDikeToeAtPolder);
Assert.IsNaN(actualInput.PhreaticLineOffsets.BelowDikeTopAtPolder);
Assert.IsNaN(actualInput.PhreaticLineOffsets.BelowDikeTopAtRiver);
@@ -486,6 +486,44 @@
}
[Test]
+ public void Calculate_GridDeterminationTypeAutomatic_SetsInputOnCalculator()
+ {
+ // Setup
+ var random = new Random(11);
+ MacroStabilityInwardsInput inputParameters = testCalculation.InputParameters;
+ inputParameters.GridDeterminationType = MacroStabilityInwardsGridDeterminationType.Automatic;
+ inputParameters.TangentLineZTop = random.NextRoundedDouble();
+ inputParameters.TangentLineZBottom = random.NextRoundedDouble();
+ inputParameters.LeftGrid.XLeft = random.NextRoundedDouble();
+ inputParameters.LeftGrid.XRight = random.NextRoundedDouble();
+ inputParameters.LeftGrid.ZTop = random.NextRoundedDouble();
+ inputParameters.LeftGrid.ZBottom = random.NextRoundedDouble();
+ inputParameters.LeftGrid.NumberOfHorizontalPoints = random.Next();
+ inputParameters.LeftGrid.NumberOfVerticalPoints = random.Next();
+ inputParameters.RightGrid.XLeft = random.NextRoundedDouble();
+ inputParameters.RightGrid.XRight = random.NextRoundedDouble();
+ inputParameters.RightGrid.ZTop = random.NextRoundedDouble();
+ inputParameters.RightGrid.ZBottom = random.NextRoundedDouble();
+ inputParameters.RightGrid.NumberOfHorizontalPoints = random.Next();
+ inputParameters.RightGrid.NumberOfVerticalPoints = random.Next();
+
+ using (new MacroStabilityInwardsCalculatorFactoryConfig())
+ {
+ // Call
+ MacroStabilityInwardsCalculationService.Calculate(testCalculation);
+
+ // Assert
+ UpliftVanCalculatorInput actualInput = ((TestMacroStabilityInwardsCalculatorFactory)MacroStabilityInwardsCalculatorFactory.Instance)
+ .LastCreatedUpliftVanCalculator.Input;
+ Assert.IsTrue(actualInput.SlipPlane.GridAutomaticDetermined);
+ Assert.IsNaN(actualInput.SlipPlane.TangentZTop);
+ Assert.IsNaN(actualInput.SlipPlane.TangentZBottom);
+ Assert.IsNull(actualInput.SlipPlane.LeftGrid);
+ Assert.IsNull(actualInput.SlipPlane.RightGrid);
+ }
+ }
+
+ [Test]
public void Calculate_CalculationRan_SetOutput()
{
// Setup