Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs =================================================================== diff -u -r8905298103eb01ce13dd5c1a2f267f879d4fda3e -r240a0a7285d67b54d0c3a992a0e60856c2e9855d --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision 8905298103eb01ce13dd5c1a2f267f879d4fda3e) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision 240a0a7285d67b54d0c3a992a0e60856c2e9855d) @@ -254,8 +254,16 @@ tempEntryPointL = localGeometry.ElementAt(entryPointIndex).X; } - ExitPointL = (RoundedDouble) tempExitPointL; - EntryPointL = (RoundedDouble) tempEntryPointL; + if (tempExitPointL <= ExitPointL) + { + EntryPointL = (RoundedDouble)tempEntryPointL; + ExitPointL = (RoundedDouble)tempExitPointL; + } + else + { + ExitPointL = (RoundedDouble) tempExitPointL; + EntryPointL = (RoundedDouble) tempEntryPointL; + } } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs =================================================================== diff -u -ra2b2a6d3aa2dedbc0a3c594a84636493df29fb85 -r240a0a7285d67b54d0c3a992a0e60856c2e9855d --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision a2b2a6d3aa2dedbc0a3c594a84636493df29fb85) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision 240a0a7285d67b54d0c3a992a0e60856c2e9855d) @@ -313,7 +313,7 @@ } [Test] - public void SurfaceLine_WithDikeToes_ThenExitPointLAndEntryPointLUpdated() + public void SurfaceLine_WithDikeToes_ExitPointLAndEntryPointLUpdated() { // Given PipingInput input = new PipingInput(new GeneralPipingInput()); @@ -337,6 +337,68 @@ } [Test] + public void SurfaceLine_DikeToesBeyondSetExitPointL_ExitPointLAndEntryPointLUpdated() + { + // Given + PipingInput input = new PipingInput(new GeneralPipingInput()); + + RingtoetsPipingSurfaceLine surfaceLine = new RingtoetsPipingSurfaceLine(); + surfaceLine.SetGeometry(new[] + { + new Point3D(0, 0, 0), + new Point3D(1, 0, 2), + new Point3D(2, 0, 3), + new Point3D(3, 0, 0), + new Point3D(4, 0, 2), + new Point3D(5, 0, 3) + }); + surfaceLine.SetDikeToeAtRiverAt(new Point3D(2, 0, 3)); + surfaceLine.SetDikeToeAtPolderAt(new Point3D(3, 0, 0)); + + input.SurfaceLine = surfaceLine; + input.EntryPointL = (RoundedDouble) 0; + input.ExitPointL = (RoundedDouble) 1; + + // Call + input.SurfaceLine = surfaceLine; + + // Assert + Assert.AreEqual(new RoundedDouble(2, 2), input.EntryPointL); + Assert.AreEqual(new RoundedDouble(3, 3), input.ExitPointL); + } + + [Test] + public void SurfaceLine_DikeToesBeforeSetEntreePointL_ExitPointLAndEntryPointLUpdated() + { + // Given + PipingInput input = new PipingInput(new GeneralPipingInput()); + + RingtoetsPipingSurfaceLine surfaceLine = new RingtoetsPipingSurfaceLine(); + surfaceLine.SetGeometry(new[] + { + new Point3D(0, 0, 0), + new Point3D(1, 0, 2), + new Point3D(2, 0, 3), + new Point3D(3, 0, 0), + new Point3D(4, 0, 2), + new Point3D(5, 0, 3) + }); + surfaceLine.SetDikeToeAtRiverAt(new Point3D(2, 0, 3)); + surfaceLine.SetDikeToeAtPolderAt(new Point3D(3, 0, 0)); + + input.SurfaceLine = surfaceLine; + input.ExitPointL = (RoundedDouble) 5; + input.EntryPointL = (RoundedDouble) 4; + + // Call + input.SurfaceLine = surfaceLine; + + // Assert + Assert.AreEqual(new RoundedDouble(2, 2), input.EntryPointL); + Assert.AreEqual(new RoundedDouble(2, 3), input.ExitPointL); + } + + [Test] public void PhreaticLevelExit_SetNewValue_UpdateMeanAndStandardDeviation() { // Setup