Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs =================================================================== diff -u -r0f8ecad9de486dac8a81bb9de57e76ca6cf8a104 -r63511ecef2fc0350f51475d844b88e870f440075 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 0f8ecad9de486dac8a81bb9de57e76ca6cf8a104) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 63511ecef2fc0350f51475d844b88e870f440075) @@ -224,6 +224,15 @@ } /// + /// Looks up a localized string similar to Kan uittredepunt niet zetten.. + /// + public static string RingtoetsPipingSurfaceLine_ExitPointL_Cannot_set_exit_point_at_L_0 { + get { + return ResourceManager.GetString("RingtoetsPipingSurfaceLine_ExitPointL_Cannot_set_exit_point_at_L_0", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Kan geen hoogte bepalen.. /// public static string RingtoetsPipingSurfaceLine_GetZAtL_Cannot_determine_height { Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx =================================================================== diff -u -r0f8ecad9de486dac8a81bb9de57e76ca6cf8a104 -r63511ecef2fc0350f51475d844b88e870f440075 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx (.../Resources.resx) (revision 0f8ecad9de486dac8a81bb9de57e76ca6cf8a104) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx (.../Resources.resx) (revision 63511ecef2fc0350f51475d844b88e870f440075) @@ -183,4 +183,7 @@ Kan geen hoogte bepalen. + + Kan uittredepunt niet zetten. + \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs =================================================================== diff -u -r0f8ecad9de486dac8a81bb9de57e76ca6cf8a104 -r63511ecef2fc0350f51475d844b88e870f440075 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 0f8ecad9de486dac8a81bb9de57e76ca6cf8a104) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 63511ecef2fc0350f51475d844b88e870f440075) @@ -38,6 +38,7 @@ { private Point3D[] geometryPoints; private double entryPointL; + private double exitPointL; /// /// Initializes a new instance of the class. @@ -114,10 +115,29 @@ } /// + /// Gets or sets the L-coördinate of the exit point. + /// + /// is not in range of the LZ-projected . + /// is empty. + public double ExitPointL + { + get + { + return exitPointL; + } + set + { + ValidateHasPoints(); + ValidateInRange(value, ProjectGeometryToLZ().ToArray(), Resources.RingtoetsPipingSurfaceLine_ExitPointL_Cannot_set_exit_point_at_L_0); + exitPointL = value; + } + } + + /// /// Sets the geometry of the surfaceline. /// /// The collection of points defining the surfaceline geometry. - /// Thrown when any of the has no value (== null). + /// Thrown when any element of is null. public void SetGeometry(IEnumerable points) { if (points == null) Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs =================================================================== diff -u -r0f8ecad9de486dac8a81bb9de57e76ca6cf8a104 -r63511ecef2fc0350f51475d844b88e870f440075 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 0f8ecad9de486dac8a81bb9de57e76ca6cf8a104) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 63511ecef2fc0350f51475d844b88e870f440075) @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; - +using System.Runtime.Remoting; using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Framework; @@ -414,6 +414,7 @@ // Assert Assert.AreEqual(testL, surfaceLine.EntryPointL); } + [Test] [TestCase(-1.0)] [TestCase(-1e-6)] @@ -445,6 +446,93 @@ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); } + [Test] + public void EntryPointL_EmptyGeometry_ThrowsInvalidOperationException() + { + // Setup + var surfaceLine = new RingtoetsPipingSurfaceLine(); + + // Call + TestDelegate test = () => surfaceLine.EntryPointL = new Random(21).NextDouble(); + + // Assert + var expectedMessage = "De profielmeting heeft geen geometrie."; + var message = Assert.Throws(test).Message; + Assert.AreEqual(expectedMessage, message); + } + + [Test] + [TestCase(0.0)] + [TestCase(3.0)] + [TestCase(4.0)] + public void ExitPointL_WithinGeometryRange_ValueSet(double testL) + { + // Setup + var surfaceLine = new RingtoetsPipingSurfaceLine(); + surfaceLine.SetGeometry(new[] + { + new Point3D + { + X = 1.0, Y = 0.0, Z = 0.0 + }, + new Point3D + { + X = 5.0, Y = 0.0, Z = 0.0 + } + }); + + // Call + surfaceLine.ExitPointL = testL; + + // Assert + Assert.AreEqual(testL, surfaceLine.ExitPointL); + } + [Test] + [TestCase(-1.0)] + [TestCase(-1e-6)] + [TestCase(4.1 + 1e-6)] + [TestCase(5.0)] + public void ExitPointL_OutsideGeometryRange_ThrowsArgumentOutOfRangeException(double testL) + { + // Setup + var surfaceLine = new RingtoetsPipingSurfaceLine(); + var min = 1.0; + var max = 5.1; + surfaceLine.SetGeometry(new[] + { + new Point3D + { + X = min, Y = 0.0, Z = 0.0 + }, + new Point3D + { + X = max, Y = 0.0, Z = 0.0 + } + }); + + // Call + TestDelegate test = () => surfaceLine.ExitPointL = testL; + + // Assert + var expectedMessage = "Kan uittredepunt niet zetten. L moet in het bereik van [0, 4.1] liggen."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + + [Test] + public void ExitPointL_EmptyGeometry_ThrowsInvalidOperationException() + { + // Setup + var surfaceLine = new RingtoetsPipingSurfaceLine(); + + // Call + TestDelegate test = () => surfaceLine.ExitPointL = new Random(21).NextDouble(); + + // Assert + var expectedMessage = "De profielmeting heeft geen geometrie."; + var message = Assert.Throws(test).Message; + Assert.AreEqual(expectedMessage, message); + } + private static void CreateTestGeometry(Point3D testPoint, RingtoetsPipingSurfaceLine surfaceLine) { var random = new Random(21);