Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfile.cs
===================================================================
diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7)
@@ -22,7 +22,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-
using Ringtoets.Piping.Data.Properties;
namespace Ringtoets.Piping.Data
@@ -78,14 +77,40 @@
{
throw new ArgumentNullException(@"value", string.Format(Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers));
}
- if(!value.Any())
+ if (!value.Any())
{
- throw new ArgumentException(string.Format(Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers));
+ throw new ArgumentException(Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers);
}
+ if (value.Any(l => l.Top < Bottom))
+ {
+ throw new ArgumentException(Resources.PipingSoilProfile_Layers_Layer_top_below_profile_bottom);
+ }
layers = value.OrderByDescending(l => l.Top).ToArray();
}
}
+ ///
+ /// Gets the thickness of the given layer in the .
+ /// Thickness of a layer is determined by its top and the top of the layer below it.
+ ///
+ /// The to determine the thickness of.
+ /// The thickness of the .
+ /// does not contain .
+ public double GetLayerThickness(PipingSoilLayer layer)
+ {
+ var orderedLayers = layers.OrderBy(l => l.Top);
+ var previousLevel = Bottom;
+ foreach (var oLayer in orderedLayers)
+ {
+ if (ReferenceEquals(layer, oLayer))
+ {
+ return layer.Top - previousLevel;
+ }
+ previousLevel = oLayer.Top;
+ }
+ throw new ArgumentException("Layer not found in profile.");
+ }
+
public override string ToString()
{
return Name;
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs
===================================================================
diff -u -r816d01207222c8359c772a9387a53784530d557a -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 816d01207222c8359c772a9387a53784530d557a)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.18444
+// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -250,6 +250,15 @@
}
///
+ /// Looks up a localized string similar to Eén of meerdere lagen hebben een top onder de bodem van het profiel..
+ ///
+ public static string PipingSoilProfile_Layers_Layer_top_below_profile_bottom {
+ get {
+ return ResourceManager.GetString("PipingSoilProfile_Layers_Layer_top_below_profile_bottom", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to {0} L moet in het bereik van [{1}, {2}] liggen..
///
public static string RingtoetsPipingSurfaceLine_0_L_needs_to_be_in_1_2_range {
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx
===================================================================
diff -u -r816d01207222c8359c772a9387a53784530d557a -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx (.../Resources.resx) (revision 816d01207222c8359c772a9387a53784530d557a)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx (.../Resources.resx) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7)
@@ -204,4 +204,7 @@
De waarde voor het L-coördinaat van het intredepunt mag niet kleiner zijn dan 0.
+
+ Eén of meerdere lagen hebben een top onder de bodem van het profiel.
+
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Extensions/PipingInputExtensions.cs
===================================================================
diff -u -r816d01207222c8359c772a9387a53784530d557a -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Extensions/PipingInputExtensions.cs (.../PipingInputExtensions.cs) (revision 816d01207222c8359c772a9387a53784530d557a)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Extensions/PipingInputExtensions.cs (.../PipingInputExtensions.cs) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7)
@@ -28,12 +28,14 @@
input.SurfaceLine = surfaceLine;
input.UpdateValuesBasedOnSurfaceLine();
input.UpdateThicknessCoverageLayer();
+ input.UpdateThicknessAquiferLayer();
}
public static void SetSoilProfile(this PipingInput input, PipingSoilProfile soilProfile)
{
input.SoilProfile = soilProfile;
input.UpdateThicknessCoverageLayer();
+ input.UpdateThicknessAquiferLayer();
}
///
@@ -63,8 +65,32 @@
{
input.ExitPointL = exitPointL;
input.UpdateThicknessCoverageLayer();
+ input.UpdateThicknessAquiferLayer();
}
+ private static void UpdateThicknessAquiferLayer(this PipingInput input)
+ {
+ var soilProfile = input.SoilProfile;
+ if (soilProfile != null && input.SurfaceLine != null && !double.IsNaN(input.ExitPointL))
+ {
+ var aquiferLayersBelowSurfaceLine = soilProfile.Layers.Where(l => l.IsAquifer && l.Top <= input.SurfaceLine.GetZAtL(input.ExitPointL)).ToArray();
+ if (aquiferLayersBelowSurfaceLine.Any())
+ {
+ try
+ {
+ input.ThicknessAquiferLayer.Mean = soilProfile.GetLayerThickness(aquiferLayersBelowSurfaceLine.First());
+ return;
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ // error handling performed after try-catch
+ }
+ }
+ }
+ logger.Warn(Resources.PipingInputExtensions_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer);
+ input.ThicknessAquiferLayer.Mean = double.NaN;
+ }
+
private static void UpdateThicknessCoverageLayer(this PipingInput input)
{
if (input.SurfaceLine != null && input.SoilProfile != null)
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r816d01207222c8359c772a9387a53784530d557a -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 816d01207222c8359c772a9387a53784530d557a)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7)
@@ -1084,6 +1084,16 @@
}
///
+ /// Looks up a localized string similar to Kan de dikte van het watervoerend pakket niet afleiden op basis van de invoer..
+ ///
+ public static string PipingInputExtensions_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer {
+ get {
+ return ResourceManager.GetString("PipingInputExtensions_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aqui" +
+ "fer_layer", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Kan deklaagdikte niet afleiden op basis van de invoer..
///
public static string PipingInputExtensions_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer {
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx
===================================================================
diff -u -r816d01207222c8359c772a9387a53784530d557a -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision 816d01207222c8359c772a9387a53784530d557a)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7)
@@ -598,4 +598,7 @@
b
+
+ Kan de dikte van het watervoerend pakket niet afleiden op basis van de invoer.
+
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingProfileCreatorTest.cs
===================================================================
diff -u -r3479f17e22ed8f8f44470972f85f9478707af683 -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7
--- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingProfileCreatorTest.cs (.../PipingProfileCreatorTest.cs) (revision 3479f17e22ed8f8f44470972f85f9478707af683)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingProfileCreatorTest.cs (.../PipingProfileCreatorTest.cs) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7)
@@ -19,7 +19,7 @@
// Setup
var random = new Random(22);
var expectedTop = random.NextDouble();
- var expectedBottom = random.NextDouble();
+ var expectedBottom = expectedTop - random.NextDouble();
var belowPhreaticLevel = random.NextDouble();
var abovePhreaticLevel = random.NextDouble();
var dryUnitWeight = random.NextDouble();
@@ -62,7 +62,7 @@
var expectedTopA = random.NextDouble();
var expectedTopB = expectedTopA - random.NextDouble();
var expectedTopC = expectedTopB - random.NextDouble();
- var expectedBottom = random.NextDouble();
+ var expectedBottom = expectedTopC - random.NextDouble();
IEnumerable layers = new[]
{
new PipingSoilLayer(expectedTopA)
@@ -99,7 +99,7 @@
var expectedTopA = random.NextDouble();
var expectedTopB = random.NextDouble() + expectedTopA;
var expectedTopC = random.NextDouble() + expectedTopB;
- var expectedBottom = random.NextDouble();
+ var expectedBottom = expectedTopA - random.NextDouble();
IEnumerable layers = new[]
{
new PipingSoilLayer(expectedTopA)
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs
===================================================================
diff -u -rd2b5b334c49948fa49297a1d24c13bc98aa6ee1e -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs (.../PipingSoilProfileTest.cs) (revision d2b5b334c49948fa49297a1d24c13bc98aa6ee1e)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs (.../PipingSoilProfileTest.cs) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7)
@@ -1,46 +1,43 @@
using System;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Linq;
+using Core.Common.TestUtil;
using NUnit.Framework;
namespace Ringtoets.Piping.Data.Test
{
public class PipingSoilProfileTest
{
[Test]
- [TestCase(1)]
- [TestCase(5)]
- public void Constructor_WithNameBottomLayersAndAquifer_ReturnsInstanceWithPropsAndEquivalentLayerCollection(int layerCount)
+ public void Constructor_WithNameBottomLayersAndAquifer_ReturnsInstanceWithPropsAndEquivalentLayerCollection()
{
// Setup
var name = "Profile";
- var bottom = new Random(22).NextDouble();
- var equivalentLayers = new Collection();
- for (var i = 0; i < layerCount; i++)
+ var random = new Random(22);
+ var bottom = random.NextDouble();
+ var layers = new Collection
{
- equivalentLayers.Add(new PipingSoilLayer(0.0)
- {
- IsAquifer = i == 0
- });
- }
+ new PipingSoilLayer(bottom)
+ };
// Call
- var profile = new PipingSoilProfile(name, bottom, equivalentLayers);
+ var profile = new PipingSoilProfile(name, bottom, layers);
// Assert
- Assert.AreNotSame(equivalentLayers, profile.Layers);
- CollectionAssert.AreEqual(equivalentLayers, profile.Layers);
+ Assert.AreNotSame(layers, profile.Layers);
Assert.AreEqual(name, profile.Name);
Assert.AreEqual(bottom, profile.Bottom);
}
+
[Test]
public void Constructor_WithNameBottomLayersEmpty_ThrowsArgumentException()
{
// Call
TestDelegate test = () => new PipingSoilProfile(String.Empty, Double.NaN, new Collection());
// Assert
- var message = Assert.Throws(test).Message;
- Assert.AreEqual(Properties.Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers, message);
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, Properties.Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers);
}
[Test]
@@ -50,11 +47,96 @@
TestDelegate test = () => new PipingSoilProfile(String.Empty, Double.NaN, null);
// Assert
- var message = Assert.Throws(test).Message;
- StringAssert.StartsWith(Properties.Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers, message);
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, Properties.Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers);
}
[Test]
+ [TestCase(1)]
+ [TestCase(5)]
+ [TestCase(15)]
+ public void Layers_Always_ReturnsDescendingByTopOrderedList(int layerCount)
+ {
+ // Setup
+ var random = new Random(21);
+ var bottom = 0.0;
+ var equivalentLayers = new List(layerCount);
+ for (var i = 0; i < layerCount; i++)
+ {
+ equivalentLayers.Add(new PipingSoilLayer(random.NextDouble())
+ {
+ IsAquifer = i == 0
+ });
+ }
+
+ var profile = new PipingSoilProfile(string.Empty, bottom, equivalentLayers);
+
+ // Call
+ var result = profile.Layers.ToArray();
+
+ // Assert
+ CollectionAssert.AreEquivalent(equivalentLayers, result);
+ CollectionAssert.AreEqual(equivalentLayers.OrderByDescending(l => l.Top).Select(l => l.Top), result.Select(l => l.Top));
+ }
+
+ [Test]
+ [TestCase(1e-6)]
+ [TestCase(4)]
+ public void Constructor_WithNameBottomLayersBelowBottom_ThrowsArgumentException(double deltaBelowBottom)
+ {
+ // Setup
+ var bottom = 0.0;
+ var pipingSoilLayers = new[]
+ {
+ new PipingSoilLayer(bottom - deltaBelowBottom),
+ new PipingSoilLayer(1.1)
+ };
+
+ // Call
+ TestDelegate test = () => new PipingSoilProfile(String.Empty, bottom, pipingSoilLayers);
+
+ // Assert
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "Eén of meerdere lagen hebben een top onder de bodem van het profiel.");
+ }
+
+ [Test]
+ [TestCase(0,0)]
+ [TestCase(1,1.1)]
+ public void GetLayerThickness_LayerInProfile_ReturnsThicknessOfLayer(int layerIndex, double expectedThickness)
+ {
+ // Setup
+ var pipingSoilLayers = new[]
+ {
+ new PipingSoilLayer(0.0),
+ new PipingSoilLayer(1.1)
+ };
+ var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers);
+
+ // Call
+ var thickness = profile.GetLayerThickness(pipingSoilLayers[layerIndex]);
+
+ // Assert
+ Assert.AreEqual(expectedThickness, thickness);
+ }
+
+ [Test]
+ public void GetLayerThickness_LayerNotInProfile_ThrowsArgumentException()
+ {
+ // Setup
+ var pipingSoilLayers = new[]
+ {
+ new PipingSoilLayer(0.0),
+ new PipingSoilLayer(1.1)
+ };
+ var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers);
+
+ // Call
+ TestDelegate test = () => profile.GetLayerThickness(new PipingSoilLayer(1.1));
+
+ // Assert
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "Layer not found in profile.");
+ }
+
+ [Test]
[TestCase(null)]
[TestCase("")]
[TestCase("some name")]
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Extensions/PipingInputExtensionsTest.cs
===================================================================
diff -u -r816d01207222c8359c772a9387a53784530d557a -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Extensions/PipingInputExtensionsTest.cs (.../PipingInputExtensionsTest.cs) (revision 816d01207222c8359c772a9387a53784530d557a)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Extensions/PipingInputExtensionsTest.cs (.../PipingInputExtensionsTest.cs) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7)
@@ -264,6 +264,7 @@
[Test]
[TestCase(0)]
[TestCase(1)]
+ [TestCase(2)]
public void ThicknessCoverageLayer_WithMissingInput_ThicknessSetToNaNAndLog(int inputIndexMissing)
{
// Setup
@@ -296,6 +297,10 @@
{
call = () => input.SetSoilProfile(soilProfile);
}
+ if (inputIndexMissing != 2)
+ {
+ call = () => input.SetExitPointL(0.5);
+ }
// Assert
TestHelper.AssertLogMessageIsGenerated(call, Resources.PipingInputExtensions_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer);
@@ -335,7 +340,8 @@
[Test]
[TestCase(0)]
[TestCase(1)]
- public void ThicknessCoverageLayer_HadThicknessCoverageLayerChangeToMissingInput_ThicknessSetToNaNAndLog(int inputIndexMissing)
+ [TestCase(2)]
+ public void ThicknessCoverageLayer_ChangeToMissingInput_ThicknessSetToNaNAndLog(int inputIndexMissing)
{
// Setup
var surfaceLine = new RingtoetsPipingSurfaceLine();
@@ -369,6 +375,10 @@
{
call = () => input.SetSoilProfile(null);
}
+ if (inputIndexMissing == 2)
+ {
+ call = () => input.SetExitPointL(double.NaN);
+ }
// Assert
TestHelper.AssertLogMessageIsGenerated(call, Resources.PipingInputExtensions_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer);
@@ -390,6 +400,10 @@
new PipingSoilLayer(2.0)
{
IsAquifer = true
+ },
+ new PipingSoilLayer(2.0)
+ {
+ IsAquifer = false
}
});
@@ -450,7 +464,7 @@
}
[Test]
- public void SetSoilProfile_WithSurfaceLineAndExitPointL_ThicknessUpdated()
+ public void SetSoilProfile_WithSurfaceLineAndExitPointL_CoverageThicknessUpdated()
{
// Setup
var surfaceLine = new RingtoetsPipingSurfaceLine();
@@ -490,6 +504,259 @@
}
[Test]
+ [TestCase(0)]
+ [TestCase(1)]
+ [TestCase(2)]
+ public void ThicknessAquiferLayer_WithMissingInput_ThicknessSetToNaNAndLog(int inputIndexMissing)
+ {
+ // Setup
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(0,0,2.0),
+ new Point3D(1.0,0,2.0),
+ });
+ var soilProfile = new PipingSoilProfile(String.Empty, 0, new[]
+ {
+ new PipingSoilLayer(1.0)
+ {
+ IsAquifer = true
+ },
+ new PipingSoilLayer(2.0)
+ {
+ IsAquifer = false
+ }
+ });
+ var input = new PipingInput(new GeneralPipingInput());
+
+ // Call
+ Action call = null;
+ if (inputIndexMissing != 0)
+ {
+ call = () => input.SetSurfaceLine(surfaceLine);
+ }
+ if (inputIndexMissing != 1)
+ {
+ call = () => input.SetSoilProfile(soilProfile);
+ }
+ if (inputIndexMissing != 2)
+ {
+ call = () => input.SetExitPointL(0.5);
+ }
+
+ // Assert
+ TestHelper.AssertLogMessageIsGenerated(call, Resources.PipingInputExtensions_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer);
+ Assert.IsNaN(input.ThicknessAquiferLayer.Mean);
+ }
+
+ [Test]
+ public void ThicknessAquiferLayer_SoilProfileSingleAquiferUnderSurfaceLine_MeanSet()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(0,0,2.0),
+ new Point3D(1.0,0,2.0),
+ });
+ var soilProfile = new PipingSoilProfile(String.Empty, 0, new[]
+ {
+ new PipingSoilLayer(1.0)
+ {
+ IsAquifer = true
+ },
+ new PipingSoilLayer(2.0)
+ {
+ IsAquifer = false
+ }
+ });
+ var input = new PipingInput(new GeneralPipingInput())
+ {
+ SurfaceLine = surfaceLine,
+ ExitPointL = 0.5
+ };
+
+ input.SetSoilProfile(soilProfile);
+
+ // Call
+ var result = input.ThicknessAquiferLayer.Mean;
+
+ // Assert
+ Assert.AreSame(soilProfile, input.SoilProfile);
+ Assert.AreEqual(1.0, result);
+ }
+
+ [Test]
+ [TestCase(1e-6)]
+ [TestCase(1)]
+ public void ThicknessAquiferLayer_SoilProfileSingleAquiferAboveSurfaceLine_MeanSetToNaN(double deltaAboveSurfaceLine)
+ {
+ // Setup
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ var surfaceLineTopLevel = 2.0;
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(0,0,surfaceLineTopLevel),
+ new Point3D(1.0,0,surfaceLineTopLevel),
+ });
+ var soilProfile = new PipingSoilProfile(String.Empty, 0, new[]
+ {
+ new PipingSoilLayer(surfaceLineTopLevel + deltaAboveSurfaceLine)
+ {
+ IsAquifer = false
+ },
+ new PipingSoilLayer(surfaceLineTopLevel + deltaAboveSurfaceLine + 1)
+ {
+ IsAquifer = true
+ }
+ });
+ var input = new PipingInput(new GeneralPipingInput())
+ {
+ SurfaceLine = surfaceLine,
+ ExitPointL = 0.5
+ };
+
+ input.SetSoilProfile(soilProfile);
+
+ // Call
+ var result = input.ThicknessAquiferLayer.Mean;
+
+ // Assert
+ Assert.AreSame(soilProfile, input.SoilProfile);
+ Assert.IsNaN(result);
+ }
+
+ [Test]
+ public void ThicknessAquiferLayer_SoilProfileMultipleAquiferUnderSurfaceLine_MeanSetToTopAquiferThickness()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ var firstAquiferThickness = 1.1;
+ var secondAquiferThickness = 2.2;
+ var totalAquiferThickness = firstAquiferThickness + secondAquiferThickness;
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(0,0,totalAquiferThickness),
+ new Point3D(1.0,0,totalAquiferThickness),
+ });
+ var soilProfile = new PipingSoilProfile(String.Empty, 0, new[]
+ {
+ new PipingSoilLayer(firstAquiferThickness)
+ {
+ IsAquifer = true
+ },
+ new PipingSoilLayer(firstAquiferThickness + secondAquiferThickness)
+ {
+ IsAquifer = true
+ },
+ new PipingSoilLayer(totalAquiferThickness + 1)
+ {
+ IsAquifer = false
+ }
+ });
+ var input = new PipingInput(new GeneralPipingInput())
+ {
+ SurfaceLine = surfaceLine,
+ ExitPointL = 0.5
+ };
+
+ input.SetSoilProfile(soilProfile);
+
+ // Call
+ var result = input.ThicknessAquiferLayer.Mean;
+
+ // Assert
+ Assert.AreSame(soilProfile, input.SoilProfile);
+ Assert.AreEqual(secondAquiferThickness, result);
+ }
+
+ [Test]
+ [TestCase(0)]
+ [TestCase(1)]
+ [TestCase(2)]
+ public void ThicknessAquiferLayer_ChangeToMissingInput_ThicknessSetToNaNAndLog(int inputIndexMissing)
+ {
+ // Setup
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(0,0,2.0),
+ new Point3D(1.0,0,2.0),
+ });
+ var soilProfile = new PipingSoilProfile(String.Empty, 0, new[]
+ {
+ new PipingSoilLayer(1.0)
+ {
+ IsAquifer = true
+ },
+ new PipingSoilLayer(2.0)
+ {
+ IsAquifer = false
+ }
+ });
+ var input = new PipingInput(new GeneralPipingInput());
+ input.SetSurfaceLine(surfaceLine);
+ input.SetSoilProfile(soilProfile);
+
+ // Call
+ Action call = null;
+ if (inputIndexMissing == 0)
+ {
+ call = () => input.SetSurfaceLine(null);
+ }
+ if (inputIndexMissing == 1)
+ {
+ call = () => input.SetSoilProfile(null);
+ }
+ if (inputIndexMissing == 2)
+ {
+ call = () => input.SetExitPointL(double.NaN);
+ }
+
+ // Assert
+ TestHelper.AssertLogMessageIsGenerated(call, "Kan de dikte van het watervoerend pakket niet afleiden op basis van de invoer.");
+ Assert.IsNaN(input.ThicknessAquiferLayer.Mean);
+ }
+
+ [Test]
+ public void ThicknessAquiferLayer_InputResultsInZeroThickness_ThicknessSetToNaNAndLog()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(0,0,2.0),
+ new Point3D(1.0,0,2.0),
+ });
+ var soilProfile = new PipingSoilProfile(String.Empty, 0, new[]
+ {
+ new PipingSoilLayer(0.0)
+ {
+ IsAquifer = true
+ },
+ new PipingSoilLayer(2.0)
+ {
+ IsAquifer = false
+ }
+ });
+
+ var input = new PipingInput(new GeneralPipingInput());
+
+ input.SetSurfaceLine(surfaceLine);
+ input.SetExitPointL(0.5);
+
+ // Call
+ input.SetSoilProfile(soilProfile);
+
+ // Call
+ Action call = () => input.SetSoilProfile(soilProfile);
+
+ // Assert
+ TestHelper.AssertLogMessageIsGenerated(call, Resources.PipingInputExtensions_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer);
+ Assert.IsNaN(input.ThicknessAquiferLayer.Mean);
+ }
+
+ [Test]
public void SetExitPointL_WithSoilProfileAndExitPointL_ThicknessUpdated()
{
// Setup
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder1DTest.cs
===================================================================
diff -u -rd2b5b334c49948fa49297a1d24c13bc98aa6ee1e -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder1DTest.cs (.../SoilProfileBuilder1DTest.cs) (revision d2b5b334c49948fa49297a1d24c13bc98aa6ee1e)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder1DTest.cs (.../SoilProfileBuilder1DTest.cs) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7)
@@ -53,8 +53,8 @@
var profileName = "SomeProfile";
var random = new Random(22);
var bottom = random.NextDouble();
- var top = random.NextDouble();
- var top2 = random.NextDouble();
+ var top = bottom + random.NextDouble();
+ var top2 = bottom + random.NextDouble();
var builder = new SoilProfileBuilder1D(profileName, bottom);
builder.Add(new PipingSoilLayer(top)
Index: Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs
===================================================================
diff -u -r1c01ea681887e96b5b80fb7d23680a4eeac9bd50 -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7
--- Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs (.../PipingCalculationServiceTest.cs) (revision 1c01ea681887e96b5b80fb7d23680a4eeac9bd50)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs (.../PipingCalculationServiceTest.cs) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7)
@@ -58,9 +58,11 @@
// Make invalid by having surfaceline partially above soil profile:
double highestLevelSurfaceLine = invalidPipingCalculation.InputParameters.SurfaceLine.Points.Max(p => p.Z);
- invalidPipingCalculation.InputParameters.SoilProfile = new PipingSoilProfile("A", 0, new[]
+ var soilProfileTop = highestLevelSurfaceLine - 0.5;
+ var soilProfileBottom = soilProfileTop - 0.5;
+ invalidPipingCalculation.InputParameters.SoilProfile = new PipingSoilProfile("A", soilProfileBottom, new[]
{
- new PipingSoilLayer(highestLevelSurfaceLine-0.5)
+ new PipingSoilLayer(soilProfileTop)
{
IsAquifer = true
}