Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs =================================================================== diff -u -r5077 -r5081 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs (.../MacroStabilityIoTests.cs) (revision 5077) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs (.../MacroStabilityIoTests.cs) (revision 5081) @@ -524,29 +524,73 @@ return slices; } - - [Test] - // ToDo: Add XEntry etc. MWDAM-2255 - public void GivenDamKernelInput_WhenTransferSlipPlaneConstraints_ThenSlipPlaneConstraintsAreTransferred() + + public class GivenDamKernelInput { - // Given - var damKernelInput = new DamKernelInput + private readonly DamKernelInput damKernelInput = CreateDamKernelInputWithForbiddenZone(); + + [Test] + [TestCase(0.0, 5.0)] + [TestCase(0.2, 6.0)] + [TestCase(1.0, 10.0)] + public void WithForbiddenZone_WhenTransferSlipPlaneConstraints_ThenSlipPlaneConstraintsAreSet(double forbiddenZoneFactor,double xEntryMax) { - Location = new Location() + damKernelInput.Location.StabilityOptions.ForbiddenZoneFactor = forbiddenZoneFactor; + var macroStabilityInput = new MacroStabilityInput(); + // When + FillMacroStabilityWrapperInputFromEngine.TransferSlipPlaneConstraints(damKernelInput.Location, macroStabilityInput.StabilityModel.SlipPlaneConstraints); + Assert.Multiple(() => { - SurfaceLine = new SurfaceLine2 {}, - StabilityOptions = new StabilityOptions + // Then + Assert.That(macroStabilityInput.StabilityModel.SlipPlaneConstraints.SlipPlaneMinDepth, Is.EqualTo(1.5)); + Assert.That(macroStabilityInput.StabilityModel.SlipPlaneConstraints.XEntryMin, Is.EqualTo(1.0)); + Assert.That(macroStabilityInput.StabilityModel.SlipPlaneConstraints.XEntryMax, Is.EqualTo(xEntryMax)); + }); + } + + [Test] + public void WithNoZones_WhenTransferSlipPlaneConstraints_ThenXEntryIsNotSet() + { + damKernelInput.Location.StabilityOptions.StabilityZoneType = MStabZonesType.NoZones; + var macroStabilityInput = new MacroStabilityInput(); + // When + FillMacroStabilityWrapperInputFromEngine.TransferSlipPlaneConstraints(damKernelInput.Location, macroStabilityInput.StabilityModel.SlipPlaneConstraints); + Assert.Multiple(() => + { + // Then + Assert.That(macroStabilityInput.StabilityModel.SlipPlaneConstraints.SlipPlaneMinDepth, Is.EqualTo(1.5)); + Assert.That(macroStabilityInput.StabilityModel.SlipPlaneConstraints.XEntryMin, Is.NaN); + Assert.That(macroStabilityInput.StabilityModel.SlipPlaneConstraints.XEntryMax, Is.NaN); + }); + } + + private static DamKernelInput CreateDamKernelInputWithForbiddenZone() + { + var surfaceLine = new SurfaceLine2() + { + CharacteristicPoints = { - MinimalCircleDepth = 1.5 + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + surfaceLine.EnsurePointOfType(1.0, 0, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(5.0, 0, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(10.0, 0, CharacteristicPointType.DikeToeAtPolder); + var damKernelInput = new DamKernelInput + { + Location = new Location() + { + SurfaceLine = surfaceLine, + StabilityOptions = new StabilityOptions + { + MinimalCircleDepth = 1.5, + StabilityZoneType = MStabZonesType.ForbiddenZone, + ForbiddenZoneFactor = 0.2 + } } - } - }; - var macroStabilityInput = new MacroStabilityInput - { - }; - // When - FillMacroStabilityWrapperInputFromEngine.TransferSlipPlaneConstraints(damKernelInput.Location, macroStabilityInput.StabilityModel.SlipPlaneConstraints); - // Then - Assert.That(macroStabilityInput.StabilityModel.SlipPlaneConstraints.SlipPlaneMinDepth, Is.EqualTo(1.5)); + }; + return damKernelInput; + } } } \ No newline at end of file