Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Importers/MacroStabilityInwardsSurfaceLineExtensions.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Importers/MacroStabilityInwardsSurfaceLineExtensions.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Importers/MacroStabilityInwardsSurfaceLineExtensions.cs (revision b2d6fb0b948754d598692e76e2dc1a25b311d7e7)
@@ -0,0 +1,396 @@
+// 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 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 General Public License for more details.
+//
+// You should have received a copy of the GNU 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;
+using Core.Common.Base.Geometry;
+using log4net;
+using Ringtoets.Common.IO.SurfaceLines;
+using Ringtoets.MacroStabilityInwards.Primitives;
+using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources;
+using RingtoetsCommonIoResources = Ringtoets.Common.IO.Properties.Resources;
+using MacroStabilityInwardsIOResources = Ringtoets.MacroStabilityInwards.IO.Properties.Resources;
+
+namespace Ringtoets.MacroStabilityInwards.IO.Importers
+{
+ ///
+ /// Extension methods for the class.
+ ///
+ public static class MacroStabilityInwardsSurfaceLineExtensions
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(MacroStabilityInwardsSurfaceLineExtensions));
+
+ ///
+ /// Tries to set the relevant characteristic points from the
+ /// on the .
+ ///
+ /// The surface line to set the characteristic points for.
+ /// The characteristic points to set, if the collection is valid.
+ /// Thrown when is null.
+ /// Thrown when a mandatory characteristic point is not
+ /// present or not on the given .
+ public static void SetCharacteristicPoints(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, CharacteristicPoints characteristicPoints)
+ {
+ if (surfaceLine == null)
+ {
+ throw new ArgumentNullException(nameof(surfaceLine));
+ }
+
+ if (characteristicPoints == null)
+ {
+ throw new SurfaceLineTransformException($"Karakteristieke punten definitie voor profielschematisatie '{surfaceLine.Name}' is verplicht.");
+ }
+
+ surfaceLine.TrySetSurfaceLevelOutside(characteristicPoints.SurfaceLevelOutside);
+ surfaceLine.TrySetDikeToeAtRiver(characteristicPoints.DikeToeAtRiver);
+ surfaceLine.TrySetDikeTopAtPolder(characteristicPoints.DikeTopAtPolder);
+ surfaceLine.TrySetDikeToeAtPolder(characteristicPoints.DikeToeAtPolder);
+ surfaceLine.TrySetSurfaceLevelInside(characteristicPoints.SurfaceLevelInside);
+
+ surfaceLine.TrySetTrafficLoadOutside(characteristicPoints.TrafficLoadOutside);
+ surfaceLine.TrySetTrafficLoadInside(characteristicPoints.TrafficLoadInside);
+ surfaceLine.TrySetShoulderBaseInside(characteristicPoints.ShoulderBaseInside);
+ surfaceLine.TrySetShoulderTopInside(characteristicPoints.ShoulderTopInside);
+ surfaceLine.TrySetDitchDikeSide(characteristicPoints.DitchDikeSide);
+ surfaceLine.TrySetBottomDitchDikeSide(characteristicPoints.BottomDitchDikeSide);
+ surfaceLine.TrySetBottomDitchPolderSide(characteristicPoints.BottomDitchPolderSide);
+ surfaceLine.TrySetDitchPolderSide(characteristicPoints.DitchPolderSide);
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ private static void TrySetDitchPolderSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetDitchPolderSideAt(point);
+ }
+ catch (ArgumentException e)
+ {
+ LogOptionalCharacteristicPointError(surfaceLine, e);
+ }
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ private static void TrySetBottomDitchPolderSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetBottomDitchPolderSideAt(point);
+ }
+ catch (ArgumentException e)
+ {
+ LogOptionalCharacteristicPointError(surfaceLine, e);
+ }
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ private static void TrySetBottomDitchDikeSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetBottomDitchDikeSideAt(point);
+ }
+ catch (ArgumentException e)
+ {
+ LogOptionalCharacteristicPointError(surfaceLine, e);
+ }
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ private static void TrySetDitchDikeSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetDitchDikeSideAt(point);
+ }
+ catch (ArgumentException e)
+ {
+ LogOptionalCharacteristicPointError(surfaceLine, e);
+ }
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// Thrown when is null or
+ /// not on the .
+ private static void TrySetSurfaceLevelInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ try
+ {
+ surfaceLine.SetSurfaceLevelInsideAt(point);
+ }
+ catch (ArgumentNullException)
+ {
+ throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_SurfaceLevelInside), surfaceLine.Name);
+ }
+ catch (ArgumentException e)
+ {
+ throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name);
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// Thrown when is null or
+ /// not on the .
+ private static void TrySetSurfaceLevelOutside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ try
+ {
+ surfaceLine.SetSurfaceLevelOutsideAt(point);
+ }
+ catch (ArgumentNullException)
+ {
+ throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_SurfaceLevelOutside), surfaceLine.Name);
+ }
+ catch (ArgumentException e)
+ {
+ throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name);
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// Thrown when is null or
+ /// not on the .
+ private static void TrySetDikeTopAtPolder(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ try
+ {
+ surfaceLine.SetDikeTopAtPolderAt(point);
+ }
+ catch (ArgumentNullException)
+ {
+ throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_DikeTopAtPolder), surfaceLine.Name);
+ }
+ catch (ArgumentException e)
+ {
+ throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name);
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ private static void TrySetShoulderBaseInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetShoulderBaseInsideAt(point);
+ }
+ catch (ArgumentException e)
+ {
+ LogOptionalCharacteristicPointError(surfaceLine, e);
+ }
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ private static void TrySetShoulderTopInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetShoulderTopInsideAt(point);
+ }
+ catch (ArgumentException e)
+ {
+ LogOptionalCharacteristicPointError(surfaceLine, e);
+ }
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ private static void TrySetTrafficLoadInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetTrafficLoadInsideAt(point);
+ }
+ catch (ArgumentException e)
+ {
+ LogOptionalCharacteristicPointError(surfaceLine, e);
+ }
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ private static void TrySetTrafficLoadOutside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetTrafficLoadOutsideAt(point);
+ }
+ catch (ArgumentException e)
+ {
+ LogOptionalCharacteristicPointError(surfaceLine, e);
+ }
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// Thrown when is null or
+ /// not on the .
+ private static void TrySetDikeToeAtRiver(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ try
+ {
+ surfaceLine.SetDikeToeAtRiverAt(point);
+ }
+ catch (ArgumentNullException)
+ {
+ throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtRiver), surfaceLine.Name);
+ }
+ catch (ArgumentException e)
+ {
+ throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name);
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// Thrown when is null or
+ /// not on the .
+ private static void TrySetDikeToeAtPolder(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ try
+ {
+ surfaceLine.SetDikeToeAtPolderAt(point);
+ }
+ catch (ArgumentNullException)
+ {
+ throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtPolder), surfaceLine.Name);
+ }
+ catch (ArgumentException e)
+ {
+ throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name);
+ }
+ }
+
+ private static void LogOptionalCharacteristicPointError(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, ArgumentException e)
+ {
+ log.ErrorFormat(RingtoetsCommonIoResources.SurfaceLinesCsvImporter_CharacteristicPoint_of_SurfaceLine_0_skipped_cause_1_,
+ surfaceLine.Name,
+ e.Message);
+ }
+
+ private static string CreateMissingMandatoryPointMessage(string surfaceLineName)
+ {
+ return string.Format(MacroStabilityInwardsIOResources.MacroStabilityInwardsSurfaceLineTransformer_CharacteristicPoint_0_is_undefined, surfaceLineName);
+ }
+
+ private static SurfaceLineTransformException CreateMandatoryCharacteristicPointException(string exceptionMessage, string surfaceLineName)
+ {
+ string message = string.Format(MacroStabilityInwardsIOResources.SurfaceLinesCsvImporter_SurfaceLine_0_skipped_cause_1_CharacteristicPoint_mandatory, surfaceLineName, exceptionMessage);
+ return new SurfaceLineTransformException(message);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag b2d6fb0b948754d598692e76e2dc1a25b311d7e7 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Importers/RingtoetsMacroStabilityInwardsSurfaceLineExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Ringtoets.MacroStabilityInwards.IO.csproj
===================================================================
diff -u -r5579d8fdef4f553fb4ba94160825ec960b89bab9 -rb2d6fb0b948754d598692e76e2dc1a25b311d7e7
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Ringtoets.MacroStabilityInwards.IO.csproj (.../Ringtoets.MacroStabilityInwards.IO.csproj) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Ringtoets.MacroStabilityInwards.IO.csproj (.../Ringtoets.MacroStabilityInwards.IO.csproj) (revision b2d6fb0b948754d598692e76e2dc1a25b311d7e7)
@@ -51,7 +51,7 @@
-
+
True
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/MacroStabilityInwardsSurfaceLineExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/MacroStabilityInwardsSurfaceLineExtensionsTest.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/MacroStabilityInwardsSurfaceLineExtensionsTest.cs (revision b2d6fb0b948754d598692e76e2dc1a25b311d7e7)
@@ -0,0 +1,326 @@
+// 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 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 General Public License for more details.
+//
+// You should have received a copy of the GNU 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;
+using System.Collections.Generic;
+using System.Linq;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.Common.IO.SurfaceLines;
+using Ringtoets.MacroStabilityInwards.IO.Importers;
+using Ringtoets.MacroStabilityInwards.Primitives;
+using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources;
+
+namespace Ringtoets.MacroStabilityInwards.IO.Test.Importers
+{
+ [TestFixture]
+ public class MacroStabilityInwardsSurfaceLineExtensionsTest
+ {
+ private static IEnumerable DifferentCharacteristicPointConfigurationsWithMissingMandatoryPoint
+ {
+ get
+ {
+ var name = "Missing SurfaceLevelOutside";
+ CharacteristicPoints set = CreateCompleteCharacteristicPointSet(name);
+ set.SurfaceLevelOutside = null;
+ yield return new TestCaseData(set, RingtoetsCommonDataResources.CharacteristicPoint_SurfaceLevelOutside).SetName(name);
+
+ name = "Missing DikeToeAtRiver";
+ set = CreateCompleteCharacteristicPointSet(name);
+ set.DikeToeAtRiver = null;
+ yield return new TestCaseData(set, RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtRiver).SetName(name);
+
+ name = "Missing DikeTopAtPolder";
+ set = CreateCompleteCharacteristicPointSet(name);
+ set.DikeTopAtPolder = null;
+ yield return new TestCaseData(set, RingtoetsCommonDataResources.CharacteristicPoint_DikeTopAtPolder).SetName(name);
+
+ name = "Missing DikeToeAtPolder";
+ set = CreateCompleteCharacteristicPointSet(name);
+ set.DikeToeAtPolder = null;
+ yield return new TestCaseData(set, RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtPolder).SetName(name);
+
+ name = "Missing SurfaceLevelInside";
+ set = CreateCompleteCharacteristicPointSet(name);
+ set.SurfaceLevelInside = null;
+ yield return new TestCaseData(set, RingtoetsCommonDataResources.CharacteristicPoint_SurfaceLevelInside).SetName(name);
+ }
+ }
+
+ private static IEnumerable DifferentCharacteristicPointConfigurationsWithMandatoryPointNotOnSurfaceLine
+ {
+ get
+ {
+ var name = "Moved SurfaceLevelOutside";
+ CharacteristicPoints set = CreateCompleteCharacteristicPointSet(name);
+ yield return new TestCaseData(
+ set,
+ new Action((points, p) => points.SurfaceLevelOutside = p),
+ RingtoetsCommonDataResources.CharacteristicPoint_SurfaceLevelOutside).SetName(name);
+
+ name = "Moved DikeToeAtRiver";
+ set = CreateCompleteCharacteristicPointSet(name);
+ yield return new TestCaseData(
+ set,
+ new Action((points, p) => points.DikeToeAtRiver = p),
+ RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtRiver).SetName(name);
+
+ name = "Moved DikeTopAtPolder";
+ set = CreateCompleteCharacteristicPointSet(name);
+ yield return new TestCaseData(
+ set,
+ new Action((points, p) => points.DikeTopAtPolder = p),
+ RingtoetsCommonDataResources.CharacteristicPoint_DikeTopAtPolder).SetName(name);
+
+ name = "Moved DikeToeAtPolder";
+ set = CreateCompleteCharacteristicPointSet(name);
+ yield return new TestCaseData(
+ set,
+ new Action((points, p) => points.DikeToeAtPolder = p),
+ RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtPolder).SetName(name);
+
+ name = "Moved SurfaceLevelInside";
+ set = CreateCompleteCharacteristicPointSet(name);
+ yield return new TestCaseData(
+ set,
+ new Action((points, p) => points.SurfaceLevelInside = p),
+ RingtoetsCommonDataResources.CharacteristicPoint_SurfaceLevelInside).SetName(name);
+ }
+ }
+
+ private static IEnumerable DifferentValidCharacteristicPointConfigurations
+ {
+ get
+ {
+ var name = "All present";
+ CharacteristicPoints set = CreateCompleteCharacteristicPointSet(name);
+ yield return new TestCaseData(set).SetName(name);
+
+ name = "Missing ShoulderBaseInside";
+ set = CreateCompleteCharacteristicPointSet(name);
+ set.ShoulderBaseInside = null;
+ yield return new TestCaseData(set).SetName(name);
+
+ name = "Missing ShoulderTopInside";
+ set = CreateCompleteCharacteristicPointSet(name);
+ set.ShoulderTopInside = null;
+ yield return new TestCaseData(set).SetName(name);
+
+ name = "Missing TrafficLoadOutside";
+ set = CreateCompleteCharacteristicPointSet(name);
+ set.TrafficLoadOutside = null;
+ yield return new TestCaseData(set).SetName(name);
+
+ name = "Missing TrafficLoadInside";
+ set = CreateCompleteCharacteristicPointSet(name);
+ set.TrafficLoadInside = null;
+ yield return new TestCaseData(set).SetName(name);
+
+ name = "Missing DitchDikeSide";
+ set = CreateCompleteCharacteristicPointSet(name);
+ set.DitchDikeSide = null;
+ yield return new TestCaseData(set).SetName(name);
+
+ name = "Missing BottomDitchDikeSide";
+ set = CreateCompleteCharacteristicPointSet(name);
+ set.BottomDitchDikeSide = null;
+ yield return new TestCaseData(set).SetName(name);
+
+ name = "Missing BottomDitchPolderSide";
+ set = CreateCompleteCharacteristicPointSet(name);
+ set.BottomDitchPolderSide = null;
+ yield return new TestCaseData(set).SetName(name);
+
+ name = "Missing DitchPolderSide";
+ set = CreateCompleteCharacteristicPointSet(name);
+ set.DitchPolderSide = null;
+ yield return new TestCaseData(set).SetName(name);
+ }
+ }
+
+ [Test]
+ public void SetCharacteristicPoints_SurfaceLineNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => ((RingtoetsMacroStabilityInwardsSurfaceLine) null).SetCharacteristicPoints(new CharacteristicPoints("Empty"));
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("surfaceLine", exception.ParamName);
+ }
+
+ [Test]
+ public void SetCharacteristicPoints_CharacteristicPointsNull_ThrowsSurfaceLineTransformException()
+ {
+ // Setup
+ const string name = "Some line name";
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = name
+ };
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(3, 2, 5),
+ new Point3D(3.4, 3, 8),
+ new Point3D(4.4, 6, 8),
+ new Point3D(5.1, 6, 6.5),
+ new Point3D(8.5, 7.2, 4.2),
+ new Point3D(9.6, 7.5, 3.9)
+ });
+
+ // Call
+ TestDelegate test = () => surfaceLine.SetCharacteristicPoints(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual($"Karakteristieke punten definitie voor profielschematisatie '{name}' is verplicht.", exception.Message);
+ }
+
+ [Test]
+ [TestCaseSource(nameof(DifferentValidCharacteristicPointConfigurations))]
+ public void SetCharacteristicPoints_ValidSituations_PointsAreSet(CharacteristicPoints points)
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+ surfaceLine.SetGeometry(CharacteristicPointsToGeometry(points));
+
+ // Call
+ surfaceLine.SetCharacteristicPoints(points);
+
+ // Assert
+ Assert.AreEqual(points.DikeTopAtPolder, surfaceLine.DikeTopAtPolder);
+ Assert.AreEqual(points.ShoulderBaseInside, surfaceLine.ShoulderBaseInside);
+ Assert.AreEqual(points.ShoulderTopInside, surfaceLine.ShoulderTopInside);
+ Assert.AreEqual(points.TrafficLoadOutside, surfaceLine.TrafficLoadOutside);
+ Assert.AreEqual(points.TrafficLoadInside, surfaceLine.TrafficLoadInside);
+ Assert.AreEqual(points.SurfaceLevelOutside, surfaceLine.SurfaceLevelOutside);
+ Assert.AreEqual(points.SurfaceLevelInside, surfaceLine.SurfaceLevelInside);
+ Assert.AreEqual(points.DikeToeAtRiver, surfaceLine.DikeToeAtRiver);
+ Assert.AreEqual(points.DikeToeAtPolder, surfaceLine.DikeToeAtPolder);
+ Assert.AreEqual(points.DitchDikeSide, surfaceLine.DitchDikeSide);
+ Assert.AreEqual(points.BottomDitchDikeSide, surfaceLine.BottomDitchDikeSide);
+ Assert.AreEqual(points.BottomDitchPolderSide, surfaceLine.BottomDitchPolderSide);
+ Assert.AreEqual(points.DitchPolderSide, surfaceLine.DitchPolderSide);
+ }
+
+ [Test]
+ [TestCaseSource(nameof(DifferentCharacteristicPointConfigurationsWithMissingMandatoryPoint))]
+ public void SetCharacteristicPoints_UndefinedMandatoryPoint_ThrowsSurfaceLineTransformException(CharacteristicPoints points, string pointDescription)
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = points.Name
+ };
+ surfaceLine.SetGeometry(CharacteristicPointsToGeometry(points));
+
+ // Call
+ TestDelegate test = () => surfaceLine.SetCharacteristicPoints(points);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ string message = $"Profielschematisatie '{points.Name}' kan niet gebruikt worden. Karakteristiek punt \'{pointDescription}\' is niet gedefiniëerd. Dit karakteristieke punt is verplicht.";
+ Assert.AreEqual(message, exception.Message);
+ }
+
+ [Test]
+ [TestCaseSource(nameof(DifferentCharacteristicPointConfigurationsWithMandatoryPointNotOnSurfaceLine))]
+ public void SetCharacteristicPoints_MandatoryPointNotOnSurfaceLine_ThrowsSurfaceLineTransformException(
+ CharacteristicPoints points,
+ Action setPoint,
+ string pointDescription)
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = points.Name
+ };
+ surfaceLine.SetGeometry(CharacteristicPointsToGeometry(points));
+
+ var changedPoint = new Point3D(-1, -1, -1);
+ setPoint(points, changedPoint);
+
+ // Call
+ TestDelegate test = () => surfaceLine.SetCharacteristicPoints(points);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ string message = $"Profielschematisatie '{points.Name}' kan niet gebruikt worden. " +
+ $"De geometrie bevat geen punt op locatie {changedPoint} om als \'{pointDescription}\' in te stellen. " +
+ "Dit karakteristieke punt is verplicht.";
+ Assert.AreEqual(message, exception.Message);
+ }
+
+ private static IEnumerable CharacteristicPointsToGeometry(CharacteristicPoints points)
+ {
+ return new[]
+ {
+ points.DikeTopAtPolder,
+ points.ShoulderBaseInside,
+ points.ShoulderTopInside,
+ points.TrafficLoadOutside,
+ points.TrafficLoadInside,
+ points.SurfaceLevelOutside,
+ points.SurfaceLevelInside,
+ points.DikeToeAtRiver,
+ points.DikeToeAtPolder,
+ points.DitchDikeSide,
+ points.BottomDitchDikeSide,
+ points.BottomDitchPolderSide,
+ points.DitchPolderSide
+ }.Where(p => p != null);
+ }
+
+ private static CharacteristicPoints CreateCompleteCharacteristicPointSet(string name)
+ {
+ var surfaceLevelOutside = new Point3D(2, 2, 5);
+ var dikeToeAtRiver = new Point3D(2.1, 2, 5);
+ var trafficLoadOutside = new Point3D(2.25, 2, 5);
+ var trafficLoadInside = new Point3D(2.45, 2, 5);
+ var dikeTopAtPolder = new Point3D(2.7, 2, 5);
+ var shoulderBaseInside = new Point3D(3.2, 2, 5);
+ var shoulderTopInside = new Point3D(3.5, 2, 5);
+ var dikeToeAtPolder = new Point3D(4.4, 3, 8);
+ var ditchDikeSide = new Point3D(6.3, 6, 8);
+ var bottomDitchDikeSide = new Point3D(5.1, 6, 6.5);
+ var bottomDitchPolderSide = new Point3D(8.5, 7.2, 4.2);
+ var ditchPolderSide = new Point3D(9.6, 7.5, 3.9);
+ var surfaceLevelInside = new Point3D(10.1, 2, 5);
+
+ return new CharacteristicPoints(name)
+ {
+ DikeTopAtPolder = dikeTopAtPolder,
+ ShoulderBaseInside = shoulderBaseInside,
+ ShoulderTopInside = shoulderTopInside,
+ TrafficLoadOutside = trafficLoadOutside,
+ TrafficLoadInside = trafficLoadInside,
+ SurfaceLevelOutside = surfaceLevelOutside,
+ SurfaceLevelInside = surfaceLevelInside,
+ DikeToeAtRiver = dikeToeAtRiver,
+ DikeToeAtPolder = dikeToeAtPolder,
+ DitchDikeSide = ditchDikeSide,
+ BottomDitchDikeSide = bottomDitchDikeSide,
+ BottomDitchPolderSide = bottomDitchPolderSide,
+ DitchPolderSide = ditchPolderSide
+ };
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag b2d6fb0b948754d598692e76e2dc1a25b311d7e7 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/RingtoetsMacroStabilityInwardsSurfaceLineExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj
===================================================================
diff -u -rb04ee63f77708d3e30dd18f07dbb8ab31d548edb -rb2d6fb0b948754d598692e76e2dc1a25b311d7e7
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.Test.csproj) (revision b04ee63f77708d3e30dd18f07dbb8ab31d548edb)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.Test.csproj) (revision b2d6fb0b948754d598692e76e2dc1a25b311d7e7)
@@ -79,7 +79,7 @@
-
+
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingSurfaceLineExtensions.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingSurfaceLineExtensions.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingSurfaceLineExtensions.cs (revision b2d6fb0b948754d598692e76e2dc1a25b311d7e7)
@@ -0,0 +1,228 @@
+// 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 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 General Public License for more details.
+//
+// You should have received a copy of the GNU 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;
+using Core.Common.Base.Geometry;
+using log4net;
+using Ringtoets.Common.IO.Properties;
+using Ringtoets.Common.IO.SurfaceLines;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.IO.Importers
+{
+ ///
+ /// Extension methods for the class.
+ ///
+ public static class PipingSurfaceLineExtensions
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(PipingSurfaceLineExtensions));
+
+ ///
+ /// Tries to set the relevant characteristic points from the
+ /// on the .
+ ///
+ /// The surface line to set the characteristic points for.
+ /// The characteristic points to set, if the collection is valid.
+ /// Thrown when is null.
+ /// Thrown when defines
+ /// a dike toe at polder side in front of the dike toe at river side.
+ public static void SetCharacteristicPoints(this RingtoetsPipingSurfaceLine surfaceLine, CharacteristicPoints characteristicPoints)
+ {
+ if (surfaceLine == null)
+ {
+ throw new ArgumentNullException(nameof(surfaceLine));
+ }
+ if (characteristicPoints == null)
+ {
+ return;
+ }
+
+ surfaceLine.ValidateDikeToesInOrder(characteristicPoints);
+
+ surfaceLine.TrySetDikeToeAtRiver(characteristicPoints.DikeToeAtRiver);
+ surfaceLine.TrySetDitchDikeSide(characteristicPoints.DitchDikeSide);
+ surfaceLine.TrySetBottomDitchDikeSide(characteristicPoints.BottomDitchDikeSide);
+ surfaceLine.TrySetBottomDitchPolderSide(characteristicPoints.BottomDitchPolderSide);
+ surfaceLine.TrySetDitchPolderSide(characteristicPoints.DitchPolderSide);
+ surfaceLine.TrySetDikeToeAtPolder(characteristicPoints.DikeToeAtPolder);
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ private static void TrySetDitchPolderSide(this RingtoetsPipingSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetDitchPolderSideAt(point);
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ private static void TrySetBottomDitchPolderSide(this RingtoetsPipingSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetBottomDitchPolderSideAt(point);
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ private static void TrySetBottomDitchDikeSide(this RingtoetsPipingSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetBottomDitchDikeSideAt(point);
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ private static void TrySetDitchDikeSide(this RingtoetsPipingSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetDitchDikeSideAt(point);
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ private static void TrySetDikeToeAtRiver(this RingtoetsPipingSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetDikeToeAtRiverAt(point);
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ private static void TrySetDikeToeAtPolder(this RingtoetsPipingSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetDikeToeAtPolderAt(point);
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ }
+
+ private static void LogError(RingtoetsPipingSurfaceLine surfaceLine, ArgumentException e)
+ {
+ log.ErrorFormat(Resources.SurfaceLinesCsvImporter_CharacteristicPoint_of_SurfaceLine_0_skipped_cause_1_,
+ surfaceLine.Name,
+ e.Message);
+ }
+
+ ///
+ /// Validates whether or not the dike toes are in the right order.
+ ///
+ /// The surface line.
+ /// The characteristic points (possibly) containing the dike toes.
+ /// Thrown when the dike toes are not in the right order.
+ private static void ValidateDikeToesInOrder(this RingtoetsPipingSurfaceLine surfaceLine, CharacteristicPoints characteristicPoints)
+ {
+ if (characteristicPoints.DikeToeAtRiver != null && characteristicPoints.DikeToeAtPolder != null)
+ {
+ Point2D localDikeToeAtRiver = surfaceLine.GetLocalPointFromGeometry(characteristicPoints.DikeToeAtRiver);
+ Point2D localDikeToeAtPolder = surfaceLine.GetLocalPointFromGeometry(characteristicPoints.DikeToeAtPolder);
+
+ if (localDikeToeAtPolder.X <= localDikeToeAtRiver.X)
+ {
+ string message = string.Format(Resources.SurfaceLinesCsvImporter_CheckCharacteristicPoints_EntryPointL_greater_or_equal_to_ExitPointL_for_0_, characteristicPoints.Name);
+ throw new SurfaceLineTransformException(message);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag b2d6fb0b948754d598692e76e2dc1a25b311d7e7 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/RingtoetsPipingSurfaceLineExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj
===================================================================
diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -rb2d6fb0b948754d598692e76e2dc1a25b311d7e7
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision b2d6fb0b948754d598692e76e2dc1a25b311d7e7)
@@ -51,7 +51,7 @@
-
+
True
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingSurfaceLineExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingSurfaceLineExtensionsTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingSurfaceLineExtensionsTest.cs (revision b2d6fb0b948754d598692e76e2dc1a25b311d7e7)
@@ -0,0 +1,216 @@
+// 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 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 General Public License for more details.
+//
+// You should have received a copy of the GNU 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;
+using System.Collections.Generic;
+using System.Linq;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.Common.IO.SurfaceLines;
+using Ringtoets.Piping.IO.Importers;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.IO.Test.Importers
+{
+ [TestFixture]
+ public class PipingSurfaceLineExtensionsTest
+ {
+ private static IEnumerable DifferentValidCharacteristicPointConfigurations
+ {
+ get
+ {
+ var dikeToeAtRiver = new Point3D(3, 2, 5);
+ var dikeToeAtPolder = new Point3D(3.4, 3, 8);
+ var ditchDikeSide = new Point3D(4.4, 6, 8);
+ var bottomDitchDikeSide = new Point3D(5.1, 6, 6.5);
+ var bottomDitchPolderSide = new Point3D(8.5, 7.2, 4.2);
+ var ditchPolderSide = new Point3D(9.6, 7.5, 3.9);
+
+ var name = "All present";
+ yield return new TestCaseData(new CharacteristicPoints(name)
+ {
+ DikeToeAtRiver = dikeToeAtRiver,
+ DikeToeAtPolder = dikeToeAtPolder,
+ DitchDikeSide = ditchDikeSide,
+ BottomDitchDikeSide = bottomDitchDikeSide,
+ BottomDitchPolderSide = bottomDitchPolderSide,
+ DitchPolderSide = ditchPolderSide
+ }).SetName(name);
+
+ name = "Missing DikeToeAtRiver";
+ yield return new TestCaseData(new CharacteristicPoints(name)
+ {
+ DikeToeAtPolder = dikeToeAtPolder,
+ DitchDikeSide = ditchDikeSide,
+ BottomDitchDikeSide = bottomDitchDikeSide,
+ BottomDitchPolderSide = bottomDitchPolderSide,
+ DitchPolderSide = ditchPolderSide
+ }).SetName(name);
+
+ name = "Missing DikeToeAtPolder";
+ yield return new TestCaseData(new CharacteristicPoints(name)
+ {
+ DikeToeAtRiver = dikeToeAtRiver,
+ DitchDikeSide = ditchDikeSide,
+ BottomDitchDikeSide = bottomDitchDikeSide,
+ BottomDitchPolderSide = bottomDitchPolderSide,
+ DitchPolderSide = ditchPolderSide
+ }).SetName(name);
+
+ name = "Missing DitchDikeSide";
+ yield return new TestCaseData(new CharacteristicPoints(name)
+ {
+ DikeToeAtRiver = dikeToeAtRiver,
+ DikeToeAtPolder = dikeToeAtPolder,
+ BottomDitchDikeSide = bottomDitchDikeSide,
+ BottomDitchPolderSide = bottomDitchPolderSide,
+ DitchPolderSide = ditchPolderSide
+ }).SetName(name);
+
+ name = "Missing BottomDitchDikeSide";
+ yield return new TestCaseData(new CharacteristicPoints(name)
+ {
+ DikeToeAtRiver = dikeToeAtRiver,
+ DikeToeAtPolder = dikeToeAtPolder,
+ DitchDikeSide = ditchDikeSide,
+ BottomDitchPolderSide = bottomDitchPolderSide,
+ DitchPolderSide = ditchPolderSide
+ }).SetName(name);
+
+ name = "Missing BottomDitchPolderSide";
+ yield return new TestCaseData(new CharacteristicPoints(name)
+ {
+ DikeToeAtRiver = dikeToeAtRiver,
+ DikeToeAtPolder = dikeToeAtPolder,
+ DitchDikeSide = ditchDikeSide,
+ BottomDitchDikeSide = bottomDitchDikeSide,
+ DitchPolderSide = ditchPolderSide
+ }).SetName(name);
+
+ name = "Missing DitchPolderSide";
+ yield return new TestCaseData(new CharacteristicPoints(name)
+ {
+ DikeToeAtRiver = dikeToeAtRiver,
+ DikeToeAtPolder = dikeToeAtPolder,
+ DitchDikeSide = ditchDikeSide,
+ BottomDitchDikeSide = bottomDitchDikeSide,
+ BottomDitchPolderSide = bottomDitchPolderSide
+ }).SetName(name);
+ }
+ }
+
+ [Test]
+ public void SetCharacteristicPoints_SurfaceLineNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => ((RingtoetsPipingSurfaceLine) null).SetCharacteristicPoints(new CharacteristicPoints("Empty"));
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("surfaceLine", exception.ParamName);
+ }
+
+ [Test]
+ public void SetCharacteristicPoints_CharacteristicPointsNull_NoCharacteristicPointsSet()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(3, 2, 5),
+ new Point3D(3.4, 3, 8),
+ new Point3D(4.4, 6, 8),
+ new Point3D(5.1, 6, 6.5),
+ new Point3D(8.5, 7.2, 4.2),
+ new Point3D(9.6, 7.5, 3.9)
+ });
+
+ // Call
+ surfaceLine.SetCharacteristicPoints(null);
+
+ // Assert
+ Assert.IsNull(surfaceLine.DikeToeAtRiver);
+ Assert.IsNull(surfaceLine.DikeToeAtPolder);
+ Assert.IsNull(surfaceLine.DitchDikeSide);
+ Assert.IsNull(surfaceLine.BottomDitchDikeSide);
+ Assert.IsNull(surfaceLine.BottomDitchPolderSide);
+ Assert.IsNull(surfaceLine.DitchPolderSide);
+ }
+
+ [Test]
+ public void SetCharacteristicPoints_DikeToesReversed_ThrowsSurfaceLineTransformException()
+ {
+ // Setup
+ const string name = "Reversed dike toes";
+ var points = new CharacteristicPoints(name)
+ {
+ DikeToeAtPolder = new Point3D(3, 2, 5),
+ DikeToeAtRiver = new Point3D(3.4, 3, 8),
+ DitchDikeSide = new Point3D(4.4, 6, 8),
+ BottomDitchDikeSide = new Point3D(5.1, 6, 6.5),
+ BottomDitchPolderSide = new Point3D(8.5, 7.2, 4.2),
+ DitchPolderSide = new Point3D(9.6, 7.5, 3.9)
+ };
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(CharacteristicPointsToGeometry(points));
+
+ // Call
+ TestDelegate test = () => surfaceLine.SetCharacteristicPoints(points);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual($"Het uittredepunt moet landwaarts van het intredepunt liggen voor locatie '{name}'.", exception.Message);
+ }
+
+ [Test]
+ [TestCaseSource(nameof(DifferentValidCharacteristicPointConfigurations))]
+ public void SetCharacteristicPoints_ValidSituations_PointsAreSet(CharacteristicPoints points)
+ {
+ // Setup
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(CharacteristicPointsToGeometry(points));
+
+ // Call
+ surfaceLine.SetCharacteristicPoints(points);
+
+ // Assert
+ Assert.AreEqual(points.DikeToeAtRiver, surfaceLine.DikeToeAtRiver);
+ Assert.AreEqual(points.DikeToeAtPolder, surfaceLine.DikeToeAtPolder);
+ Assert.AreEqual(points.DitchDikeSide, surfaceLine.DitchDikeSide);
+ Assert.AreEqual(points.BottomDitchDikeSide, surfaceLine.BottomDitchDikeSide);
+ Assert.AreEqual(points.BottomDitchPolderSide, surfaceLine.BottomDitchPolderSide);
+ Assert.AreEqual(points.DitchPolderSide, surfaceLine.DitchPolderSide);
+ }
+
+ private static IEnumerable CharacteristicPointsToGeometry(CharacteristicPoints points)
+ {
+ return new[]
+ {
+ points.DikeToeAtRiver,
+ points.DikeToeAtPolder,
+ points.DitchDikeSide,
+ points.BottomDitchDikeSide,
+ points.BottomDitchPolderSide,
+ points.DitchPolderSide
+ }.Where(p => p != null);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag b2d6fb0b948754d598692e76e2dc1a25b311d7e7 refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/RingtoetsPipingSurfaceLineExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj
===================================================================
diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -rb2d6fb0b948754d598692e76e2dc1a25b311d7e7
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision b2d6fb0b948754d598692e76e2dc1a25b311d7e7)
@@ -79,7 +79,7 @@
-
+