Index: DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile2DSurfaceLineHelperTests.cs =================================================================== diff -u -r6404 -r7040 --- DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile2DSurfaceLineHelperTests.cs (.../SoilProfile2DSurfaceLineHelperTests.cs) (revision 6404) +++ DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile2DSurfaceLineHelperTests.cs (.../SoilProfile2DSurfaceLineHelperTests.cs) (revision 7040) @@ -129,19 +129,7 @@ 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([ - ..new[] - { - new Point2D(-50, 13), - new Point2D(-30, 15), - new Point2D(10, 11), - new Point2D(50, 15), - new Point2D(70, 13), - new Point2D(70, 10), - new Point2D(60, 10), - new Point2D(0, 10), - new Point2D(-20, 10), - new Point2D(-50, 10) - } + new Point2D(-50, 13), new Point2D(-30, 15), new Point2D(10, 11), new Point2D(50, 15), new Point2D(70, 13), new Point2D(70, 10), new Point2D(60, 10), new Point2D(0, 10), new Point2D(-20, 10), new Point2D(-50, 10) ], soilFilling, newSoilProfile2D), ExpectedFilling2 = null, ExpectedExtendedSurface1 = null, @@ -469,6 +457,44 @@ } } + [Test] + public void GivenSoilProfile2DWithASurfacePointCoincidingWithEndPointOfSurfaceLine_WhenCombiningWithSurfaceLine_ThenCorrectNewSoilProfile2DIsCreated() + { + // Given + SoilProfile2D soilProfile2D = FactoryForSoilProfiles.CreateSoilProfile2DWithSixSurfacesFormingTwoLayers(); + var defaultSoil = new Soil + { + Name = "Filling material" + }; + SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateHorizontalSurfaceLine(11, -50, 35); + // When + SoilProfile2D newSoilProfile2D = SoilProfile2DSurfaceLineHelper.CombineSurfaceLineWithSoilProfile2D( + surfaceLine.Geometry, soilProfile2D, defaultSoil); + + // Then + Assert.That(newSoilProfile2D, Is.Not.Null); + Assert.That(newSoilProfile2D.Surfaces, Has.Count.EqualTo(6)); + var soil1 = new Soil("Soil1"); + var soil2 = new Soil("Soil2"); + var soil3 = new Soil("Soil3"); + var soil4 = new Soil("Soil4"); + var soil5 = new Soil("Soil5"); + SoilLayer2D expectedSurface1 = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(10, 0, -50, -20, newSoilProfile2D, soil1); + SoilLayer2D expectedSurface2 = FactoryForSoilProfiles.CreatePentagonSoilLayer2D(new Point2D(-20, 10), new Point2D(0, 10), new Point2D(0, 0), new Point2D(-10, 0), new Point2D(-20, 0), newSoilProfile2D, soil2); + SoilLayer2D expectedSurface3 = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(10, 0, 0, 35, newSoilProfile2D, soil3); + SoilLayer2D expectedSurface4 = FactoryForSoilProfiles.CreatePentagonSoilLayer2D(new Point2D(-50, 0), new Point2D(-20, 0), new Point2D(-10, 0), new Point2D(-10, -15), new Point2D(-50, -15), newSoilProfile2D, soil4); + SoilLayer2D expectedSurface5 = FactoryForSoilProfiles.CreatePentagonSoilLayer2D(new Point2D(-10, 0), new Point2D(0, 0), new Point2D(35, 0), new Point2D(35, -15), new Point2D(-10, -15), newSoilProfile2D, soil5); + SoilLayer2D expectedSurfaceFilling = FactoryForSoilProfiles.CreatePolygoneSoilLayer2D([ + new Point2D(-50, 11), new Point2D(-28.75, 11), new Point2D(-7.5, 11), new Point2D(13.75, 11), new Point2D(35, 11), new Point2D(35, 10), new Point2D(0, 10), new Point2D(-20, 10), new Point2D(-50, 10) + ], defaultSoil, newSoilProfile2D); + CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface1); + CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface2); + CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface3); + CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface4); + CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurface5); + CheckSoilProfileContainsSoilLayer(newSoilProfile2D, expectedSurfaceFilling); + } + /// /// Test case class for GivenSoilProfile2DWhenCombiningWithSurfaceLineThenCorrectNewSoilProfile2DIsCreated() ///