Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj
===================================================================
diff -u -r5701 -r5743
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj (.../Deltares.DamEngine.Calculators.Tests.csproj) (revision 5701)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj (.../Deltares.DamEngine.Calculators.Tests.csproj) (revision 5743)
@@ -19,6 +19,9 @@
+
+ PreserveNewest
+
PreserveNewest
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/SoilProfileValidatorTests.cs
===================================================================
diff -u -r5456 -r5743
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/SoilProfileValidatorTests.cs (.../SoilProfileValidatorTests.cs) (revision 5456)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/SoilProfileValidatorTests.cs (.../SoilProfileValidatorTests.cs) (revision 5743)
@@ -19,11 +19,16 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.Globalization;
+using System.IO;
using System.Linq;
+using System.Threading;
using Deltares.DamEngine.Calculators.PlLinesCreator;
using Deltares.DamEngine.Data.General;
using Deltares.DamEngine.Data.Geometry;
using Deltares.DamEngine.Data.Geotechnics;
+using Deltares.DamEngine.Interface;
+using Deltares.DamEngine.TestHelpers;
using Deltares.DamEngine.TestHelpers.Factories;
using NUnit.Framework;
using Exception = System.Exception;
@@ -442,4 +447,120 @@
Assert.That(isException, Is.False, "No exception was expected however the following exception was thrown: " + e.Message);
}
}
+
+ ///
+ /// |---------------------------------------------------- Level 8 m
+ /// | Aquitard
+ /// |---------------------------------------------------- Level 6 m
+ /// |
+ /// | |--------------------| Level 4 m
+ /// | Outer loop | Inner loop |
+ /// | |--------------------| Level 2 m
+ /// |
+ /// |---------------------------------------------------- Level 0 m
+ /// | Bottom aquifer
+ /// |---------------------------------------------------- Level -10 m
+ ///
+ [Test]
+ [SetUICulture("nl-NL")]
+ [TestCase(true, true)]
+ [TestCase(true, false)]
+ [TestCase(false, true)]
+ [TestCase(false, false)]
+ public void GivenSoilProfile2DWithInnerLoop_WhenValidating_ThenExpectedResultReturned(bool isOuterLoopAquifer, bool isInnerLoopAquifer)
+ {
+ SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateHorizontalSurfaceLine(8, leftCoordinate, rightCoordinate);
+ var soilProfile = new SoilProfile2D
+ {
+ Geometry = new GeometryData
+ {
+ Left = leftCoordinate,
+ Right = rightCoordinate,
+ Bottom = -10
+ }
+ };
+ SoilLayer2D aquitard = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(8, 6, leftCoordinate, rightCoordinate, null, soilProfile, false);
+ SoilLayer2D outerLoop = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(6, 0, leftCoordinate, rightCoordinate, null, soilProfile, isOuterLoopAquifer);
+ SoilLayer2D innerLoop = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(4, 2, leftCoordinate + 1, rightCoordinate - 1, null, soilProfile, isInnerLoopAquifer);
+ SoilLayer2D bottomAquifer = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(0, -10, leftCoordinate, rightCoordinate, null, null, true);
+ soilProfile.Surfaces.Add(aquitard);
+ soilProfile.Surfaces.Add(outerLoop);
+ soilProfile.Surfaces.Add(innerLoop);
+ soilProfile.Surfaces.Add(bottomAquifer);
+ soilProfile.Geometry.Surfaces.Add(aquitard.GeometrySurface);
+ soilProfile.Geometry.Surfaces.Add(outerLoop.GeometrySurface);
+ soilProfile.Geometry.Surfaces[1].InnerLoops.Add(innerLoop.GeometrySurface.OuterLoop);
+ soilProfile.Geometry.Surfaces.Add(innerLoop.GeometrySurface);
+ soilProfile.Geometry.Surfaces.Add(bottomAquifer.GeometrySurface);
+
+ var soilProfileValidator = new SoilProfileValidator
+ {
+ SoilProfileType = SoilProfileType.ProfileType2D,
+ SurfaceLine = surfaceLine,
+ SoilProfile2D = soilProfile,
+ DikeEmbankmentMaterial = new Soil()
+ };
+ if ((isInnerLoopAquifer && !isOuterLoopAquifer) || (!isInnerLoopAquifer && isOuterLoopAquifer))
+ {
+ Assert.That(() => soilProfileValidator.ValidateSoilProfileForPlLinesCreator(),
+ Throws.InstanceOf().With.Message.EqualTo
+ (generalMessage
+ + "Ten minste één niet doorlopende watervoerende laag aanwezig."));
+ }
+ else
+ {
+ const bool isException = true;
+ try
+ {
+ soilProfileValidator.ValidateSoilProfileForPlLinesCreator();
+ }
+ catch (Exception e)
+ {
+ Assert.That(isException, Is.False, "No exception was expected however the following exception was thrown: " + e.Message);
+ }
+ }
+ }
+
+ ///
+ /// The input xml file is created using DWP 1 of Tutorial Design Stability but modifying the file DWP_1.stix by adding an extra
+ /// layer with label L 13 and material "wl_zand" inside the current layer with label L 8 and material "klei antropogeen".
+ /// The aquifers.csv file is also modified by adding layer L 13.
+ ///
+ [Test, Category(Categories.WorkInProgress)]
+ public void Given2DProfileFromXmlInput_WhenValidating_ThenExceptionReturned()
+ {
+ const string mapTestFiles = @"PlLinesCreator\TestFiles\";
+ // Setup
+ const string inputFilename = "InputFileDWP1WithInnerLoop.xml";
+ string fullInputFilename = Path.Combine(mapTestFiles, inputFilename);
+ Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
+ string inputString = File.ReadAllText(fullInputFilename);
+ var engineInterface = new EngineInterface(inputString);
+ SoilProfile2D soilProfile = engineInterface.DamProjectData.Dike.SoilProfiles2D[0];
+
+ // Check that the inner loop is present and is an aquifer
+ Assert.Multiple(() =>
+ {
+ Assert.That(soilProfile.Geometry.Surfaces, Has.Count.EqualTo(13));
+ Assert.That(soilProfile.Surfaces, Has.Count.EqualTo(13));
+ });
+ Assert.Multiple(() =>
+ {
+ Assert.That(soilProfile.Geometry.Surfaces.Where(s => s.InnerLoops.Count == 1).ToList(), Has.Count.EqualTo(1));
+ Assert.That(soilProfile.Surfaces.Where(s => s.IsAquifer).ToList(), Has.Count.EqualTo(2));
+ });
+
+ var soilProfileValidator = new SoilProfileValidator
+ {
+ SoilProfileType = SoilProfileType.ProfileType2D,
+ SurfaceLine = null,
+ SoilProfile2D = engineInterface.DamProjectData.Dike.SoilProfiles2D[0],
+ DikeEmbankmentMaterial = new Soil()
+ };
+
+ Assert.That(() => soilProfileValidator.ValidateSoilProfileForPlLinesCreator(),
+ Throws.InstanceOf().With.Message.EqualTo
+ (generalMessage + "Ten minste één niet doorlopende watervoerende laag aanwezig."));
+
+ }
}
\ No newline at end of file
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/TestFiles/InputFileDWP1WithInnerLoop.xml
===================================================================
diff -u
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/TestFiles/InputFileDWP1WithInnerLoop.xml (revision 0)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/TestFiles/InputFileDWP1WithInnerLoop.xml (revision 5743)
@@ -0,0 +1,730 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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