Index: DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilSurfaceProfileTests.cs
===================================================================
diff -u -r5386 -r5398
--- DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilSurfaceProfileTests.cs (.../SoilSurfaceProfileTests.cs) (revision 5386)
+++ DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilSurfaceProfileTests.cs (.../SoilSurfaceProfileTests.cs) (revision 5398)
@@ -766,7 +766,70 @@
new GeometryCurve(new Point2D(0, -10), new Point2D(0, -2.5))
}, bottomSoilLayer2D.GeometrySurface.OuterLoop.CurveList);
}
+
+ ///
+ /// This test reproduces the problem found in MWDAM-2514 where the ditch was incorrectly filled in.
+ /// This is due to the small vertical distance between the surface line point (32.125, -2.451) and the bottom level of
+ /// layer H_MDp_k (-2.45) which led to consider that the point was part of the layer and therefore to create a curve
+ /// closing the ditch.
+ /// Expected is that only 5 layers are created, not 6.
+ ///
+ [Test]
+ public void GivenSurfaceLineWithDitch_WhenConvertingToSoilProfile2D_ReturnsExpectedSoilProfile()
+ {
+ // Setup
+ const string layer1Name = "H_MDp_k";
+ const string layer2Name = "H_MDg_zf";
+ const string layer3Name = "H_Vhv_vo";
+ SoilLayer1D layer1 = FactoryForSoilProfiles.CreateSoilLayer(-1.78, layer1Name);
+ SoilLayer1D layer2 = FactoryForSoilProfiles.CreateSoilLayer(-2.45, layer2Name);
+ SoilLayer1D layer3 = FactoryForSoilProfiles.CreateSoilLayer(-2.95, layer3Name);
+
+ var profile = new SoilProfile1D();
+ profile.Layers.Add(layer1);
+ profile.Layers.Add(layer2);
+ profile.Layers.Add(layer3);
+ profile.BottomLevel = -4.3;
+
+ SurfaceLine2 surfaceLine = FactoryForSoilProfiles.CreateSurfaceLine(new[]
+ {
+ new GeometryPoint(0, -1.78),
+ new GeometryPoint(26, -1.78),
+ new GeometryPoint(31.775, -2.443),
+ new GeometryPoint(32.125, -2.451),
+ new GeometryPoint(34.575, -2.544),
+ new GeometryPoint(35, -3.130),
+ new GeometryPoint(37, -3.130),
+ new GeometryPoint(38.775, -2.479),
+ new GeometryPoint(39.125, -2.445),
+ new GeometryPoint(48.575, -2.156)
+ });
+
+ var soilSurfaceProfile = new SoilSurfaceProfile
+ {
+ SoilProfile = profile,
+ SurfaceLine2 = surfaceLine,
+ DikeEmbankmentMaterial = new Soil()
+ };
+
+ // Call
+ SoilProfile2D soilProfile2D = soilSurfaceProfile.ConvertToSoilProfile2D();
+
+ // Assert
+ IList soilLayer2Ds = soilProfile2D.Surfaces;
+ Assert.That(soilLayer2Ds, Has.Count.EqualTo(5));
+ Assert.Multiple(() =>
+ {
+ Assert.That(soilLayer2Ds[0].SoilName, Is.EqualTo(layer1Name));
+ Assert.That(soilLayer2Ds[1].SoilName, Is.EqualTo(layer2Name));
+ Assert.That(soilLayer2Ds[2].SoilName, Is.EqualTo(layer1Name));
+ Assert.That(soilLayer2Ds[3].SoilName, Is.EqualTo(layer2Name));
+ Assert.That(soilLayer2Ds[4].SoilName, Is.EqualTo(layer3Name));
+
+ });
+ }
+
private static void AssertGeometry(IEnumerable expectedCurves, IEnumerable actualCurves)
{
int nrOfExpectedCurves = expectedCurves.Count();