Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs
===================================================================
diff -u -r81fa8a9bf3bd503cbd280e88b8f6037a840cff12 -r56a4a2629155de0ec811598e263d4fef6e2906c3
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision 81fa8a9bf3bd503cbd280e88b8f6037a840cff12)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision 56a4a2629155de0ec811598e263d4fef6e2906c3)
@@ -171,7 +171,7 @@
set
{
surfaceLine = value;
- UpdateEntryAndExitPoint();
+ SynchronizeEntryAndExitPoint();
}
}
@@ -229,7 +229,11 @@
}
}
- private void UpdateEntryAndExitPoint()
+ ///
+ /// Synchronizes the entry and exit point with the parameters of the surface line.
+ ///
+ /// When no surface line is present, the entry and exit point are set to .
+ public void SynchronizeEntryAndExitPoint()
{
if (SurfaceLine == null)
{
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs
===================================================================
diff -u -r81fa8a9bf3bd503cbd280e88b8f6037a840cff12 -r56a4a2629155de0ec811598e263d4fef6e2906c3
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision 81fa8a9bf3bd503cbd280e88b8f6037a840cff12)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision 56a4a2629155de0ec811598e263d4fef6e2906c3)
@@ -316,7 +316,7 @@
[Test]
public void SurfaceLine_WithDikeToes_ExitPointLAndEntryPointLUpdated()
{
- // Given
+ // Setup
var input = new PipingInput(new GeneralPipingInput());
var surfaceLine = new RingtoetsPipingSurfaceLine();
@@ -340,7 +340,7 @@
[Test]
public void SurfaceLine_DikeToesBeyondSetExitPointL_ExitPointLAndEntryPointLUpdated()
{
- // Given
+ // Setup
var input = new PipingInput(new GeneralPipingInput());
var surfaceLine = new RingtoetsPipingSurfaceLine();
@@ -371,7 +371,7 @@
[Test]
public void SurfaceLine_DikeToesBeforeSetEntryPointL_ExitPointLAndEntryPointLUpdated()
{
- // Given
+ // Setup
var input = new PipingInput(new GeneralPipingInput());
var surfaceLine = new RingtoetsPipingSurfaceLine();
@@ -398,8 +398,91 @@
Assert.AreEqual(new RoundedDouble(2, 2), input.EntryPointL);
Assert.AreEqual(new RoundedDouble(2, 3), input.ExitPointL);
}
+ [Test]
+ public void SynchronizeEntryAndExitPoint_SurfaceLineNull_EntryPointLAndExitPointLNaN()
+ {
+ // Setup
+ var input = new PipingInput(new GeneralPipingInput())
+ {
+ EntryPointL = (RoundedDouble) 3,
+ ExitPointL = (RoundedDouble) 5
+ };
+ // Precondition
+ Assert.AreEqual(3, input.EntryPointL.Value);
+ Assert.AreEqual(5, input.ExitPointL.Value);
+
+ // Call
+ input.SynchronizeEntryAndExitPoint();
+
+ // Assert
+ Assert.IsNaN(input.EntryPointL);
+ Assert.IsNaN(input.ExitPointL);
+ }
+
[Test]
+ public void SynchronizeEntryAndExitPoint_DikeToesBeyondSetExitPointL_ExitPointLAndEntryPointLUpdated()
+ {
+ // Setup
+ var input = new PipingInput(new GeneralPipingInput());
+
+ var 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.SynchronizeEntryAndExitPoint();
+
+ // Assert
+ Assert.AreEqual(new RoundedDouble(2, 2), input.EntryPointL);
+ Assert.AreEqual(new RoundedDouble(3, 3), input.ExitPointL);
+ }
+
+ [Test]
+ public void SynchronizeEntryAndExitPoint_DikeToesBeforeSetEntryPointL_ExitPointLAndEntryPointLUpdated()
+ {
+ // Setup
+ var input = new PipingInput(new GeneralPipingInput());
+
+ var 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.SynchronizeEntryAndExitPoint();
+
+ // Assert
+ Assert.AreEqual(new RoundedDouble(2, 2), input.EntryPointL);
+ Assert.AreEqual(new RoundedDouble(2, 3), input.ExitPointL);
+ }
+
+ [Test]
public void GivenSurfaceLineSet_WhenSurfaceLineNull_ThenEntryAndExitPointsNaN()
{
// Given