Index: DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile2DSurfaceLineHelperTests.cs =================================================================== diff -u -r5696 -r5755 --- DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile2DSurfaceLineHelperTests.cs (.../SoilProfile2DSurfaceLineHelperTests.cs) (revision 5696) +++ DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile2DSurfaceLineHelperTests.cs (.../SoilProfile2DSurfaceLineHelperTests.cs) (revision 5755) @@ -103,6 +103,7 @@ { TestNumber = 1, GivenZigZagSurfaceLine = FactoryForSurfaceLines.CreateSurfaceLineInZigZag(-50, 10), + GivenShift = 0, ExpectedSurfaceCount = 10, // 4 extra surfaces created : 2 below the highest corners of the "zigzag" surface line + 2 on the left side (between Z=60 and 70) ExpectedFilling1 = FactoryForSoilProfiles.CreateQuadrilateralSoilLayer2D(new Point2D(-50, 10), new Point2D(-30, 12), new Point2D(-10, 10), new Point2D(-20, 10), soilFilling), @@ -125,6 +126,7 @@ { TestNumber = 2, GivenZigZagSurfaceLine = FactoryForSurfaceLines.CreateSurfaceLineInZigZag(-50, 13), + GivenShift = 0, ExpectedSurfaceCount = 9, // 3 extra surfaces created: 1 below the "zigzag" surface line + 2 on the left side (between Z=60 and 70) ExpectedFilling1 = FactoryForSoilProfiles.CreatePolygoneSoilLayer2D([ @@ -160,6 +162,7 @@ { TestNumber = 3, GivenZigZagSurfaceLine = FactoryForSurfaceLines.CreateSurfaceLineInZigZag(-50, 5), + GivenShift = 0, ExpectedSurfaceCount = 8, // 2 extra surfaces created on the left side (between Z=60 and 70) ExpectedFilling1 = null, @@ -181,6 +184,7 @@ { TestNumber = 4, GivenZigZagSurfaceLine = FactoryForSurfaceLines.CreateSurfaceLineInZigZag(-50, 0), + GivenShift = 0, ExpectedSurfaceCount = 8, // 2 extra surfaces created on the left side (between Z=60 and 70) ExpectedFilling1 = null, @@ -202,6 +206,7 @@ { TestNumber = 5, GivenZigZagSurfaceLine = FactoryForSurfaceLines.CreateSurfaceLineInZigZag(-40, 10), + GivenShift = 0, ExpectedSurfaceCount = 10, // Only few surfaces are tested ExpectedFilling1 = FactoryForSoilProfiles.CreateQuadrilateralSoilLayer2D(new Point2D(-40, 10), new Point2D(-20, 12), new Point2D(0, 10), new Point2D(-20, 10), soilFilling), @@ -223,6 +228,7 @@ { TestNumber = 6, GivenZigZagSurfaceLine = FactoryForSurfaceLines.CreateSurfaceLineInZigZag(10, 10), + GivenShift = 0, ExpectedSurfaceCount = 7, // Only few surfaces are tested ExpectedFilling1 = FactoryForSoilProfiles.CreateTriangularSoilLayer2D(new Point2D(10, 10), new Point2D(30, 12), new Point2D(50, 10), soilFilling), @@ -244,6 +250,7 @@ { TestNumber = 7, GivenZigZagSurfaceLine = FactoryForSurfaceLines.CreateSurfaceLineInZigZag(-60, 10), + GivenShift = 0, ExpectedSurfaceCount = 10, // Only few surfaces are tested ExpectedFilling1 = FactoryForSoilProfiles.CreateQuadrilateralSoilLayer2D(new Point2D(-60, 10), new Point2D(-40, 12), new Point2D(-20, 10), new Point2D(-50, 10), soilFilling), @@ -265,6 +272,7 @@ { TestNumber = 8, GivenZigZagSurfaceLine = FactoryForSurfaceLines.CreateSurfaceLineInZigZag(-110, 10), + GivenShift = 0, ExpectedSurfaceCount = 9, // Only few surfaces are tested ExpectedFilling1 = FactoryForSoilProfiles.CreateTriangularSoilLayer2D(new Point2D(-110, 10), new Point2D(-90, 12), new Point2D(-70, 10), soilFilling), @@ -286,6 +294,7 @@ { TestNumber = 9, GivenZigZagSurfaceLine = FactoryForSurfaceLines.CreateSurfaceLineInZigZag(50, -5), + GivenShift = 0, ExpectedSurfaceCount = 2, ExpectedFilling1 = null, ExpectedFilling2 = null, @@ -300,6 +309,31 @@ ExpectedSurface5 = null, ExpectedSurface6 = FactoryForSoilProfiles.CreateQuadrilateralSoilLayer2D(new Point2D(50, -5), new Point2D(60, -4), new Point2D(60, -15), new Point2D(50, -15), soil6) }).SetName("Test 9: Surface line starts inside surface line 6 (right bottom) of soil profile"); + + yield return new TestCaseData( + new TestCaseZigZagSurfaceLine + { + TestNumber = 10, + GivenZigZagSurfaceLine = FactoryForSurfaceLines.CreateSurfaceLineInZigZag(-40, 10), + GivenShift = 10, + ExpectedSurfaceCount = 10, + // 4 extra surfaces created : 2 below the highest corners of the "zigzag" surface line + 2 on the left side (between Z=70 and 80) + ExpectedFilling1 = FactoryForSoilProfiles.CreateQuadrilateralSoilLayer2D(new Point2D(-40, 10), new Point2D(-20, 12), new Point2D(0, 10), new Point2D(-10, 10), soilFilling), + ExpectedFilling2 = FactoryForSoilProfiles.CreateQuadrilateralSoilLayer2D(new Point2D(40, 10), new Point2D(60, 12), new Point2D(80, 10), new Point2D(70, 10), soilFilling), + ExpectedExtendedSurface1 = null, + ExpectedExtendedSurface3 = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(10, 0, 70, 80, soil3), + ExpectedExtendedSurface4 = null, + ExpectedExtendedSurface6 = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(0, -15, 70, 80, soil6), + ExpectedSurface1 = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(10, 0, -40, -10, soil1), + ExpectedSurface2 = FactoryForSoilProfiles.CreateHexagonSoilLayer2D(new Point2D(-10, 10), new Point2D(0, 10), new Point2D(10, 9), new Point2D(10, 0),new Point2D(0, 0), new Point2D(-10, 0), soil2), + ExpectedSurface3 = FactoryForSoilProfiles.CreateHeptagonSoilLayer2D(new Point2D(10, 9), new Point2D(20, 8), new Point2D(40, 10), new Point2D(70, 10), new Point2D(70, 0), new Point2D(45, 0), new Point2D(10, 0), soil3), + ExpectedSurface4 = FactoryForSoilProfiles.CreatePentagonSoilLayer2D(new Point2D(-40, 0), new Point2D(-10, 0), new Point2D(0, 0), new Point2D(0, -15), new Point2D(-40, -15), soil4), + ExpectedSurface5 = FactoryForSoilProfiles.CreatePentagonSoilLayer2D(new Point2D(0, 0), new Point2D(10, 0), new Point2D(45, 0), new Point2D(45, -15), new Point2D(0, -15), soil5), + ExpectedSurface6 = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(0, -15, 45, 70, soil6) + + }).SetName("Test 10: Surface line is shifted by +10 m compared to the original surface line and the geometry " + + "is shifted with 10 m. So the expected soil profile should be identical to test case 1 " + + "but should start at -40 instead of -50."); } } @@ -344,7 +378,7 @@ }; // When SoilProfile2D newSoilProfile2D = SoilProfile2DSurfaceLineHelper.CombineSurfaceLineWithSoilProfile2D( - testCaseSurfaceLine.GivenZigZagSurfaceLine.Geometry, soilProfile2D, defaultSoil, 0); + testCaseSurfaceLine.GivenZigZagSurfaceLine.Geometry, soilProfile2D, defaultSoil, testCaseSurfaceLine.GivenShift); // Then if (testCaseSurfaceLine.ExpectedSurfaceCount == 0) @@ -372,6 +406,7 @@ // New surface line is checked only for test case 6 if (testCaseSurfaceLine.TestNumber == 6) { + Assert.That(newSoilProfile2D, Is.Not.Null); Assert.That(newSoilProfile2D.Geometry.SurfaceLine.Points, Has.Count.EqualTo(8)); Assert.Multiple(() => { @@ -412,9 +447,8 @@ /// public class TestCaseSurfaceLine { - public SurfaceLine2 SurfaceLine { get; set; } - public int SurfaceCount { get; set; } - + public SurfaceLine2 SurfaceLine { get; init; } + public int SurfaceCount { get; init; } public int TestNumber { get; set; } } @@ -424,6 +458,7 @@ public class TestCaseZigZagSurfaceLine { public SurfaceLine2 GivenZigZagSurfaceLine { get; init; } + public double GivenShift { get; init; } public int ExpectedSurfaceCount { get; init; } public SoilLayer2D ExpectedSurface1 { get; init; } public SoilLayer2D ExpectedSurface2 { get; init; }