Index: Core/Common/src/Core.Common.Base/Core.Common.Base.csproj =================================================================== diff -u -r08b3bcba439831d547684b194ecdf903f2519700 -rb8fa5d6867c945f3f1744fd1455b89cadb357959 --- Core/Common/src/Core.Common.Base/Core.Common.Base.csproj (.../Core.Common.Base.csproj) (revision 08b3bcba439831d547684b194ecdf903f2519700) +++ Core/Common/src/Core.Common.Base/Core.Common.Base.csproj (.../Core.Common.Base.csproj) (revision b8fa5d6867c945f3f1744fd1455b89cadb357959) @@ -96,6 +96,7 @@ + Index: Core/Common/src/Core.Common.Base/Geometry/Point3DCollectionExtensions.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Base/Geometry/Point3DCollectionExtensions.cs (revision 0) +++ Core/Common/src/Core.Common.Base/Geometry/Point3DCollectionExtensions.cs (revision b8fa5d6867c945f3f1744fd1455b89cadb357959) @@ -0,0 +1,107 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using Core.Common.Base.Data; + +namespace Core.Common.Base.Geometry +{ + public static class Point3DCollectionExtensions + { + private const int numberOfDecimalPlaces = 2; + + /// + /// Projects the points in to localized coordinate (LZ-plane) system. + /// Z-values are retained, and the first point is put a L=0. + /// + /// Points to project. + /// Collection of 2D points in the LZ-plane. + private static RoundedPoint2DCollection ProjectGeometryToLZ(this IEnumerable points) + { + int count = points.Count(); + if (count == 0) + { + return new RoundedPoint2DCollection(numberOfDecimalPlaces, Enumerable.Empty()); + } + + Point3D first = points.First(); + if (count == 1) + { + return new RoundedPoint2DCollection(numberOfDecimalPlaces, new[] + { + new Point2D(0.0, first.Z) + }); + } + + Point3D last = points.Last(); + var firstPoint = new Point2D(first.X, first.Y); + var lastPoint = new Point2D(last.X, last.Y); + return new RoundedPoint2DCollection(numberOfDecimalPlaces, points.Select(p => p.ProjectIntoLocalCoordinates(firstPoint, lastPoint))); + } + + /// + /// Checks whether the collection results in + /// a line of zero length. + /// + /// The points forming a line to check. + /// true if the line has a length of zero; false + /// otherwise. + public static bool IsZeroLength(this IEnumerable points) + { + Point3D lastPoint = null; + foreach (Point3D point in points) + { + if (lastPoint != null) + { + if (!Equals(lastPoint, point)) + { + return false; + } + } + lastPoint = point; + } + return true; + } + + /// + /// Checks whether the locally projected would + /// return a reclining geometry. That is, given a point from the geometry + /// with an L-coordinate, has a point further in the geometry that has an + /// L-coordinate smaller than the L-coordinate of the given point. + /// + /// The points forming a line to check. + /// true if the surface line is reclining; false + /// otherwise. + public static bool IsReclining(this IEnumerable points) + { + double[] lCoordinates = points.ProjectGeometryToLZ().Select(p => p.X).ToArray(); + for (var i = 1; i < lCoordinates.Length; i++) + { + if (lCoordinates[i - 1] > lCoordinates[i]) + { + return true; + } + } + return false; + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/ISurfaceLineTransformer.cs =================================================================== diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -rb8fa5d6867c945f3f1744fd1455b89cadb357959 --- Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/ISurfaceLineTransformer.cs (.../ISurfaceLineTransformer.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381) +++ Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/ISurfaceLineTransformer.cs (.../ISurfaceLineTransformer.cs) (revision b8fa5d6867c945f3f1744fd1455b89cadb357959) @@ -24,7 +24,7 @@ namespace Ringtoets.Common.IO.SurfaceLines { /// - /// Interface for transformers of generic surface lines into mechanism specific surface lines. + /// Interface for transforming generic surface lines into mechanism specific surface lines. /// /// public interface ISurfaceLineTransformer where T : IMechanismSurfaceLine Index: Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/ISurfaceLineUpdateDataStrategy.cs =================================================================== diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -rb8fa5d6867c945f3f1744fd1455b89cadb357959 --- Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/ISurfaceLineUpdateDataStrategy.cs (.../ISurfaceLineUpdateDataStrategy.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381) +++ Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/ISurfaceLineUpdateDataStrategy.cs (.../ISurfaceLineUpdateDataStrategy.cs) (revision b8fa5d6867c945f3f1744fd1455b89cadb357959) @@ -28,13 +28,12 @@ namespace Ringtoets.Common.IO.SurfaceLines { /// - /// Interface describing the method of updating the data model after new surface lines - /// have been imported. + /// Interface for updating the data model after new surface lines have been imported. /// public interface ISurfaceLineUpdateDataStrategy where T : IMechanismSurfaceLine { /// - /// Updates the surface lines using the . + /// Updates the surface lines on the data model using the . /// /// The surface lines that need to be set on the data model. /// The source path from where the surface lines were imported from. Index: Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/SurfaceLine.cs =================================================================== diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -rb8fa5d6867c945f3f1744fd1455b89cadb357959 --- Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/SurfaceLine.cs (.../SurfaceLine.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381) +++ Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/SurfaceLine.cs (.../SurfaceLine.cs) (revision b8fa5d6867c945f3f1744fd1455b89cadb357959) @@ -30,12 +30,10 @@ namespace Ringtoets.Common.IO.SurfaceLines { /// - /// Definition of a surfaceline for piping. + /// Definition of the surface line, which is the top level geometry of a dike. /// public class SurfaceLine : Observable { - private const int numberOfDecimalPlaces = 2; - /// /// Initializes a new instance of the class. /// @@ -60,7 +58,13 @@ /// /// The collection of points defining the surfaceline geometry. /// Thrown when is null. - /// Thrown when any element of is null. + /// Thrown when either: + /// + /// Any element of is null + /// The given points are too close to eachother + /// The given points form a reclining line: one in which the local L-coordinates of the points + /// are not in ascending order. + /// public void SetGeometry(IEnumerable points) { if (points == null) @@ -71,79 +75,15 @@ { throw new ArgumentException(Resources.SurfaceLine_A_point_in_the_collection_was_null); } - Points = points.Select(p => new Point3D(p)).ToArray(); - } - - /// - /// Projects the points in to localized coordinate (LZ-plane) system. - /// Z-values are retained, and the first point is put a L=0. - /// - /// Collection of 2D points in the LZ-plane. - private RoundedPoint2DCollection ProjectGeometryToLZ() - { - int count = Points.Length; - if (count == 0) + if (points.IsZeroLength()) { - return new RoundedPoint2DCollection(numberOfDecimalPlaces, Enumerable.Empty()); + throw new ArgumentException(Resources.SurfaceLinesCsvReader_ReadLine_SurfaceLine_has_zero_length); } - - Point3D first = Points.First(); - if (count == 1) + if (points.IsReclining()) { - return new RoundedPoint2DCollection(numberOfDecimalPlaces, new[] - { - new Point2D(0.0, first.Z) - }); + throw new ArgumentException(Resources.SurfaceLinesCsvReader_ReadLine_SurfaceLine_has_reclining_geometry); } - - Point3D last = Points.Last(); - var firstPoint = new Point2D(first.X, first.Y); - var lastPoint = new Point2D(last.X, last.Y); - return new RoundedPoint2DCollection(numberOfDecimalPlaces, Points.Select(p => p.ProjectIntoLocalCoordinates(firstPoint, lastPoint))); + Points = points.Select(p => new Point3D(p)).ToArray(); } - - /// - /// Checks whether the current collection results in - /// of zero length. - /// - /// true if the surface line has a length of zero; false - /// otherwise. - public bool IsZeroLength() - { - Point3D lastPoint = null; - foreach (Point3D point in Points) - { - if (lastPoint != null) - { - if (!Equals(lastPoint, point)) - { - return false; - } - } - lastPoint = point; - } - return true; - } - - /// - /// Checks whether the current would - /// return a reclining geometry. That is, given a point from the geometry - /// with an L-coordinate, has a point further in the geometry that has an - /// L-coordinate smaller than the L-coordinate of the given point. - /// - /// true if the surface line is reclining; false - /// otherwise. - public bool IsReclining() - { - double[] lCoordinates = ProjectGeometryToLZ().Select(p => p.X).ToArray(); - for (var i = 1; i < lCoordinates.Length; i++) - { - if (lCoordinates[i - 1] > lCoordinates[i]) - { - return true; - } - } - return false; - } } } \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/SurfaceLinesCsvImporterConfiguration.cs =================================================================== diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -rb8fa5d6867c945f3f1744fd1455b89cadb357959 --- Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/SurfaceLinesCsvImporterConfiguration.cs (.../SurfaceLinesCsvImporterConfiguration.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381) +++ Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/SurfaceLinesCsvImporterConfiguration.cs (.../SurfaceLinesCsvImporterConfiguration.cs) (revision b8fa5d6867c945f3f1744fd1455b89cadb357959) @@ -25,7 +25,7 @@ namespace Ringtoets.Common.IO.SurfaceLines { /// - /// Class for configuring the used components in . + /// Configuration of the used components in . /// public class SurfaceLinesCsvImporterConfiguration where T : IMechanismSurfaceLine { @@ -51,7 +51,7 @@ } /// - /// The strategy for updating the data model with the imported surface lines. + /// The strategy for updating the data model with the mechanism specific surface lines. /// public ISurfaceLineUpdateDataStrategy UpdateUpdateStrategy { get; } Index: Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/SurfaceLinesCsvReader.cs =================================================================== diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -rb8fa5d6867c945f3f1744fd1455b89cadb357959 --- Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/SurfaceLinesCsvReader.cs (.../SurfaceLinesCsvReader.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381) +++ Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/SurfaceLinesCsvReader.cs (.../SurfaceLinesCsvReader.cs) (revision b8fa5d6867c945f3f1744fd1455b89cadb357959) @@ -199,28 +199,16 @@ { Name = surfaceLineName }; - surfaceLine.SetGeometry(points); - - CheckIfGeometryIsValid(surfaceLine); - - return surfaceLine; - } - - /// - /// Checks if the geometry defining the surface line is valid. - /// - /// The surface line to be checked. - /// Surface line geometry is invalid. - private void CheckIfGeometryIsValid(SurfaceLine surfaceLine) - { - if (surfaceLine.IsZeroLength()) + try { - throw CreateLineParseException(lineNumber, surfaceLine.Name, Resources.SurfaceLinesCsvReader_ReadLine_SurfaceLine_has_zero_length); + surfaceLine.SetGeometry(points); } - if (surfaceLine.IsReclining()) + catch (ArgumentException e) { - throw CreateLineParseException(lineNumber, surfaceLine.Name, Resources.SurfaceLinesCsvReader_ReadLine_SurfaceLine_has_reclining_geometry); + throw CreateLineParseException(lineNumber, surfaceLine.Name, e.Message); } + + return surfaceLine; } /// Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SurfaceLines/SurfaceLineTest.cs =================================================================== diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -rb8fa5d6867c945f3f1744fd1455b89cadb357959 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SurfaceLines/SurfaceLineTest.cs (.../SurfaceLineTest.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SurfaceLines/SurfaceLineTest.cs (.../SurfaceLineTest.cs) (revision b8fa5d6867c945f3f1744fd1455b89cadb357959) @@ -24,6 +24,8 @@ using System.Linq; using Core.Common.Base; using Core.Common.Base.Geometry; +using Core.Common.Base.Properties; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.IO.SurfaceLines; @@ -45,40 +47,6 @@ } [Test] - public void SetGeometry_EmptyCollection_PointsSetEmptyAndNullStartAndEndWorldPoints() - { - // Setup - var surfaceLine = new SurfaceLine(); - - IEnumerable sourceData = Enumerable.Empty(); - - // Call - surfaceLine.SetGeometry(sourceData); - - // Assert - CollectionAssert.IsEmpty(surfaceLine.Points); - } - - [Test] - public void SetGeometry_CollectionOfOnePoint_InitializeStartAndEndWorldPointsToSameInstanceAndInitializePoints() - { - // Setup - var surfaceLine = new SurfaceLine(); - - var sourceData = new[] - { - new Point3D(1.1, 2.2, 3.3) - }; - - // Call - surfaceLine.SetGeometry(sourceData); - - // Assert - Assert.AreNotSame(sourceData, surfaceLine.Points); - CollectionAssert.AreEqual(sourceData, surfaceLine.Points); - } - - [Test] public void SetGeometry_CollectionOfMultiplePoints_InitializeStartAndEndWorldPointsInitializePoints() { // Setup @@ -132,6 +100,24 @@ } [Test] + [TestCase(1)] + [TestCase(2)] + [TestCase(12)] + public void SetGeometry_GeometryIsZeroLength_ThrowArgumentException(int pointCount) + { + // Setup + var surfaceLine = new SurfaceLine(); + IEnumerable zeroLengthGeometry = Enumerable.Repeat(new Point3D(3, 4, 7), pointCount); + + // Call + TestDelegate test = () => surfaceLine.SetGeometry(zeroLengthGeometry); + + // Assert + const string expectedMessage = "Profielschematisatie heeft een geometrie die een lijn met lengte 0 beschrijft."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + + [Test] [TestCase(3.01, true)] [TestCase(3 + 1e-6, false)] [TestCase(3, false)] @@ -141,22 +127,60 @@ [TestCase(0.99, true)] [TestCase(0, true)] [TestCase(-5, true)] - public void IsReclining_ThirdPointDifferingInPosition_ReturnsTrueIfThirdPointBeforeSecondOrAfterFourth(double thirdPointL, bool expectedResult) + public void SetGeometry_GeometryIsReclining_ThrowArgumentException(double thirdPointL, bool expectedThrowsException) { // Setup var random = new Random(21); double randomY = random.NextDouble(); + var points = new[] + { + new Point3D(0, randomY, random.NextDouble()), + new Point3D(1, randomY, random.NextDouble()), + new Point3D(thirdPointL, randomY, random.NextDouble()), + new Point3D(3, randomY, random.NextDouble()) + }; var surfaceLine = new SurfaceLine(); - surfaceLine.SetGeometry(new[] + + // Call + TestDelegate test = () => surfaceLine.SetGeometry(points); + + // Assert + const string expectedMessage = "Profielschematisatie heeft een teruglopende geometrie (punten behoren een oplopende set L-coördinaten te hebben in het lokale coördinatenstelsel)."; + if (expectedThrowsException) { + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + else + { + Assert.DoesNotThrow(test); + } + } + + [Test] + [TestCase(3.01, true)] + [TestCase(3 + 1e-6, false)] + [TestCase(3, false)] + [TestCase(2, false)] + [TestCase(1, false)] + [TestCase(1 - 1e-6, false)] + [TestCase(0.99, true)] + [TestCase(0, true)] + [TestCase(-5, true)] + public void IsReclining_ThirdPointDifferingInPosition_ReturnsTrueIfThirdPointBeforeSecondOrAfterFourth(double thirdPointL, bool expectedResult) + { + // Setup + var random = new Random(21); + double randomY = random.NextDouble(); + var points = new[] + { new Point3D(0, randomY, random.NextDouble()), new Point3D(1, randomY, random.NextDouble()), new Point3D(thirdPointL, randomY, random.NextDouble()), new Point3D(3, randomY, random.NextDouble()) - }); + }; // Call - bool result = surfaceLine.IsReclining(); + bool result = points.IsReclining(); // Assert Assert.AreEqual(expectedResult, result); @@ -173,15 +197,14 @@ var random = new Random(21); double randomY = random.NextDouble(); double randomZ = random.NextDouble(); - var surfaceLine = new SurfaceLine(); - surfaceLine.SetGeometry(new[] + var points = new[] { new Point3D(2, randomY, randomZ), new Point3D(otherPointX, randomY, randomZ) - }); + }; // Call - bool result = surfaceLine.IsZeroLength(); + bool result = points.IsZeroLength(); // Assert Assert.IsFalse(result); @@ -198,15 +221,14 @@ var random = new Random(21); double randomX = random.NextDouble(); double randomY = random.NextDouble(); - var surfaceLine = new SurfaceLine(); - surfaceLine.SetGeometry(new[] + var points = new[] { new Point3D(randomX, randomY, 2), new Point3D(randomX, randomY, otherPointZ) - }); + }; // Call - bool result = surfaceLine.IsZeroLength(); + bool result = points.IsZeroLength(); // Assert Assert.IsFalse(result); @@ -223,15 +245,14 @@ var random = new Random(21); double randomX = random.NextDouble(); double randomZ = random.NextDouble(); - var surfaceLine = new SurfaceLine(); - surfaceLine.SetGeometry(new[] + var points = new[] { new Point3D(randomX, 2, randomZ), new Point3D(randomX, otherPointY, randomZ) - }); + }; // Call - bool result = surfaceLine.IsZeroLength(); + bool result = points.IsZeroLength(); // Assert Assert.IsFalse(result); @@ -244,11 +265,10 @@ public void IsZeroLength_PointsEqualToEachother_ReturnsTrue(int pointCount) { // Setup - var surfaceLine = new SurfaceLine(); - surfaceLine.SetGeometry(Enumerable.Repeat(new Point3D(3, 4, 7), pointCount)); + IEnumerable points = Enumerable.Repeat(new Point3D(3, 4, 7), pointCount); // Call - bool result = surfaceLine.IsZeroLength(); + bool result = points.IsZeroLength(); // Assert Assert.IsTrue(result); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/MacrostabilityInwardsSurfaceLineTransformerTest.cs =================================================================== diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -rb8fa5d6867c945f3f1744fd1455b89cadb357959 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/MacrostabilityInwardsSurfaceLineTransformerTest.cs (.../MacrostabilityInwardsSurfaceLineTransformerTest.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/MacrostabilityInwardsSurfaceLineTransformerTest.cs (.../MacrostabilityInwardsSurfaceLineTransformerTest.cs) (revision b8fa5d6867c945f3f1744fd1455b89cadb357959) @@ -57,7 +57,8 @@ }; surfaceLine.SetGeometry(new[] { - new Point3D(3.0, 4.0, 2.1) + new Point3D(3.0, 4.0, 2.1), + new Point3D(3.0, 5.0, 2.1) }); referenceLine.SetGeometry(new[] { @@ -67,7 +68,7 @@ IMechanismSurfaceLine result = null; // Call - Action call = () => { result = transformer.Transform(surfaceLine, null); }; + Action call = () => result = transformer.Transform(surfaceLine, null); // Assert string message = $"Profielschematisatie {surfaceLineName} doorkruist de huidige referentielijn niet of op meer dan één punt en kan niet worden geïmporteerd. Dit kan komen doordat de profielschematisatie een lokaal coördinaatsysteem heeft."; @@ -102,7 +103,7 @@ IMechanismSurfaceLine result = null; // Call - Action call = () => { result = transformer.Transform(surfaceLine, null); }; + Action call = () => result = transformer.Transform(surfaceLine, null); // Assert string message = $"Profielschematisatie {surfaceLineName} doorkruist de huidige referentielijn niet of op meer dan één punt en kan niet worden geïmporteerd."; Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingSurfaceLineTransformerTest.cs =================================================================== diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -rb8fa5d6867c945f3f1744fd1455b89cadb357959 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingSurfaceLineTransformerTest.cs (.../PipingSurfaceLineTransformerTest.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingSurfaceLineTransformerTest.cs (.../PipingSurfaceLineTransformerTest.cs) (revision b8fa5d6867c945f3f1744fd1455b89cadb357959) @@ -98,7 +98,8 @@ }; surfaceLine.SetGeometry(new[] { - new Point3D(3.0, 4.0, 2.1) + new Point3D(3.0, 4.0, 2.1), + new Point3D(3.0, 5.0, 2.1) }); referenceLine.SetGeometry(new[] { @@ -108,7 +109,7 @@ IMechanismSurfaceLine result = null; // Call - Action call = () => { result = transformer.Transform(surfaceLine, null); }; + Action call = () => result = transformer.Transform(surfaceLine, null); // Assert string message = $"Profielschematisatie {surfaceLineName} doorkruist de huidige referentielijn niet of op meer dan één punt en kan niet worden geïmporteerd. Dit kan komen doordat de profielschematisatie een lokaal coördinaatsysteem heeft."; @@ -143,7 +144,7 @@ IMechanismSurfaceLine result = null; // Call - Action call = () => { result = transformer.Transform(surfaceLine, null); }; + Action call = () => result = transformer.Transform(surfaceLine, null); // Assert string message = $"Profielschematisatie {surfaceLineName} doorkruist de huidige referentielijn niet of op meer dan één punt en kan niet worden geïmporteerd."; @@ -152,11 +153,10 @@ } [Test] - [TestCase(-1e-3)] - [TestCase(0)] - [TestCase(1e-8)] - [TestCase(6)] - public void Transform_DikeToePolderOnOrBeforeDikeToeRiver_LogErrorAndReturnNull(double delta) + [TestCase(2.0)] + [TestCase(3.0)] + [TestCase(3.5)] + public void Transform_DikeToePolderOnOrBeforeDikeToeRiver_LogErrorAndReturnNull(double xDikeToePolder) { // Setup var referenceLine = new ReferenceLine(); @@ -172,25 +172,25 @@ { new Point3D(2.0, randomY, randomZ), new Point3D(3.0, randomY, randomZ), - new Point3D(3 - delta, randomY, randomZ), + new Point3D(3.5, randomY, randomZ), new Point3D(4.0, randomY, randomZ) }); var characteristicPoints = new CharacteristicPoints(locationName) { - DikeToeAtRiver = new Point3D(3, 4, randomZ), - DikeToeAtPolder = new Point3D(3 - delta, 4, randomZ) + DikeToeAtRiver = new Point3D(3.5, 4, randomZ), + DikeToeAtPolder = new Point3D(xDikeToePolder, 4, randomZ) }; referenceLine.SetGeometry(new[] { - new Point2D(3.5, randomY - 1), - new Point2D(3.5, randomY + 1) + new Point2D(3.2, randomY - 1), + new Point2D(3.2, randomY + 1) }); IMechanismSurfaceLine result = null; // Call - Action call = () => { result = transformer.Transform(surfaceLine, characteristicPoints); }; + Action call = () => result = transformer.Transform(surfaceLine, characteristicPoints); // Assert string message = $"Het uittredepunt moet landwaarts van het intredepunt liggen voor locatie {locationName}."; @@ -248,7 +248,7 @@ RingtoetsPipingSurfaceLine result = null; // Call - Action call = () => { result = transformer.Transform(surfaceLine, characteristicPoints); }; + Action call = () => result = transformer.Transform(surfaceLine, characteristicPoints); // Assert string message = $"Karakteristiek punt van profielschematisatie '{locationName}' is overgeslagen. De geometrie bevat geen punt op locatie {notOnSurfaceLinePoint} om als '{changedCharacteristicPointName}' in te stellen.";