Index: DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile2DSurfaceLineHelperTests.cs =================================================================== diff -u -r7040 -r7042 --- DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile2DSurfaceLineHelperTests.cs (.../SoilProfile2DSurfaceLineHelperTests.cs) (revision 7040) +++ DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile2DSurfaceLineHelperTests.cs (.../SoilProfile2DSurfaceLineHelperTests.cs) (revision 7042) @@ -458,41 +458,49 @@ } [Test] - public void GivenSoilProfile2DWithASurfacePointCoincidingWithEndPointOfSurfaceLine_WhenCombiningWithSurfaceLine_ThenCorrectNewSoilProfile2DIsCreated() + [TestCase(35.002, 7)] + [TestCase(35.001,7)] + [TestCase(35.000, 6)] + [TestCase(34.999, 6)] + [TestCase(34.998, 6)] + public void GivenSoilProfile2DWithAPointCloseOrAlongXEndOfNewSurfaceLine_WhenCombiningWithSurfaceLine_ThenCorrectNewSoilProfile2DIsCreated(double xEndSurfaceLine, int expectedLayerCount) { // Given SoilProfile2D soilProfile2D = FactoryForSoilProfiles.CreateSoilProfile2DWithSixSurfacesFormingTwoLayers(); var defaultSoil = new Soil { Name = "Filling material" }; - SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateHorizontalSurfaceLine(11, -50, 35); + SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateHorizontalSurfaceLine(11, -50, xEndSurfaceLine); // 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); + Assert.That(newSoilProfile2D.Surfaces, Has.Count.EqualTo(expectedLayerCount)); + if (expectedLayerCount == 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, xEndSurfaceLine, 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(xEndSurfaceLine, 0), new Point2D(xEndSurfaceLine, -15), new Point2D(-10, -15), newSoilProfile2D, soil5); + SoilLayer2D expectedSurfaceFilling = FactoryForSoilProfiles.CreatePolygoneSoilLayer2D([ + new Point2D(-50, 11), surfaceLine.CharacteristicPoints[1].Point, surfaceLine.CharacteristicPoints[2].Point, surfaceLine.CharacteristicPoints[3].Point, new Point2D(xEndSurfaceLine, 11), new Point2D(xEndSurfaceLine, 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); + } } ///