Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/SoilProfileValidatorTests.cs =================================================================== diff -u -r5427 -r5452 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/SoilProfileValidatorTests.cs (.../SoilProfileValidatorTests.cs) (revision 5427) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/SoilProfileValidatorTests.cs (.../SoilProfileValidatorTests.cs) (revision 5452) @@ -107,7 +107,7 @@ Assert.That(() => soilProfileValidator.ValidateSoilProfileForPlLinesCreator(), Throws.InstanceOf().With.Message.EqualTo (generalMessage - + "Er is niet voldoende informatie over het ondergrondprofiel (Profiel 1D, Profiel 2D of Ophoogmateriaal dijk) beschikbaar voor de PL-lijnen te maken.")); + + "Er is niet voldoende informatie over het ondergrondprofiel (Profiel 1D, Profiel 2D of Ophoogmateriaal dijk) beschikbaar om de PL-lijnen te maken.")); } [Test] @@ -124,7 +124,7 @@ Assert.That(() => soilProfileValidator.ValidateSoilProfileForPlLinesCreator(), Throws.InstanceOf().With.Message.EqualTo (generalMessage - + "Er is niet voldoende informatie over het ondergrondprofiel (Profiel 1D, Profiel 2D of Ophoogmateriaal dijk) beschikbaar voor de PL-lijnen te maken.")); + + "Er is niet voldoende informatie over het ondergrondprofiel (Profiel 1D, Profiel 2D of Ophoogmateriaal dijk) beschikbaar om de PL-lijnen te maken.")); } [Test] @@ -140,9 +140,56 @@ Assert.That(() => soilProfileValidator.ValidateSoilProfileForPlLinesCreator(), Throws.InstanceOf().With.Message.EqualTo (generalMessage - + "Er is niet voldoende informatie over het ondergrondprofiel (Profiel 1D, Profiel 2D of Ophoogmateriaal dijk) beschikbaar voor de PL-lijnen te maken.")); + + "Er is niet voldoende informatie over het ondergrondprofiel (Profiel 1D, Profiel 2D of Ophoogmateriaal dijk) beschikbaar om de PL-lijnen te maken.")); } + + /// + /// --------------------------------------------------- Level 0 m + /// top layer + /// --------------------------------------------------- Level -10 m + /// bottom layer + /// --------------------------------------------------- Level -20 m + /// + [Test] + [SetUICulture("nl-NL")] + [TestCase(true)] + [TestCase(false)] + public void GivenSoilProfile2DWithOnlyOneLayerType_WhenValidating_ThenLanguageNLThrowsException(bool areAllLayersAquifers) + { + // Setup + SoilLayer2D soilLayerTop = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(0, -10, leftCoordinate, rightCoordinate, null, null, areAllLayersAquifers); + SoilLayer2D soilLayerBottom = FactoryForSoilProfiles.CreateRectangularSoilLayer2D(-10, -20, leftCoordinate, rightCoordinate, null, null, areAllLayersAquifers); + var soilProfile = new SoilProfile2D + { + Geometry = new GeometryData + { + Left = leftCoordinate, + Right = rightCoordinate, + Bottom = -20 + }, + Name = "SoilProfileValidatorTest" + }; + soilProfile.Surfaces.Add(soilLayerTop); + soilProfile.Surfaces.Add(soilLayerBottom); + + var soilProfileValidator = new SoilProfileValidator + { + SurfaceLine = FactoryForSurfaceLines.CreateHorizontalSurfaceLine(0, leftCoordinate, rightCoordinate), + SoilProfileType = SoilProfileType.ProfileType2D, + SoilProfile2D = soilProfile, + DikeEmbankmentMaterial = new Soil() + }; + + // Call and assert + string missingLayerType = areAllLayersAquifers ? "waterkerende" : "watervoerende"; + + Assert.That(() => soilProfileValidator.ValidateSoilProfileForPlLinesCreator(), + Throws.InstanceOf().With.Message.EqualTo + (generalMessage + + "Het ondergrondprofiel bevat geen " + missingLayerType + " laag.")); + } + /// /// --------------------------------------------------- Level 0 m /// top layer @@ -305,6 +352,16 @@ + "Ten minste één losse watervoerende laag aanwezig.")); } + /// + /// _______ Level 5 m + /// / Clay \ + /// /---------\ Level 4 m + /// / \ + /// ------------/ \ Level 2 m + /// \--------------- Level 1 m + /// Bottom aquifer + /// ------------------------------------------- Level -10 m + /// [Test] public void GivenClayDikeBodyOnSand_WhenValidating_ThenNoExceptionReturned() { @@ -337,37 +394,6 @@ } } - [Test] - public void GivenSoilProfileWithTwoClustersOfInBetweenAquifer_WhenValidating_ThenNoExceptionReturned() - { - const bool isException = true; - try - { - SoilProfile1D soilProfile1D = FactoryForSoilProfiles.CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out SurfaceLine2 surfaceLine); - var soilSurfaceProfile = new SoilSurfaceProfile - { - SoilProfile = soilProfile1D, - SurfaceLine2 = surfaceLine, - DikeEmbankmentMaterial = new Soil(), - Name = "SoilProfileWith2InBetweenAquifers" - }; - SoilProfile2D soilProfile2D = soilSurfaceProfile.ConvertToSoilProfile2D(); - - var soilProfileValidator = new SoilProfileValidator - { - SoilProfileType = SoilProfileType.ProfileType2D, - SurfaceLine = surfaceLine, - SoilProfile2D = soilProfile2D, - DikeEmbankmentMaterial = new Soil() - }; - soilProfileValidator.ValidateSoilProfileForPlLinesCreator(); - } - catch (Exception e) - { - Assert.That(isException, Is.False, "No exception was expected however the following exception was thrown: " + e.Message); - } - } - /// /// _______ Level 10 m /// / Clay \ Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SoilProfileValidator.cs =================================================================== diff -u -r5434 -r5452 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SoilProfileValidator.cs (.../SoilProfileValidator.cs) (revision 5434) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/SoilProfileValidator.cs (.../SoilProfileValidator.cs) (revision 5452) @@ -68,7 +68,7 @@ bool isNoBottomAquifer; if (SoilProfileType == SoilProfileType.ProfileType1D) { - SoilProfile1D actualSoilProfile = GetRelevantSoilProfileForAquiferLayersSearch(); + SoilProfile1D actualSoilProfile = DetermineSoilProfileAtDikeTopAtPolder(); SoilLayer1D relevantAquiferLayer = actualSoilProfile.BottomAquiferLayer; isNoBottomAquifer = relevantAquiferLayer == null; } @@ -116,7 +116,7 @@ bool isNoLayerWithGivenType; if (SoilProfileType == SoilProfileType.ProfileType1D) { - SoilProfile1D actualSoilProfile = GetRelevantSoilProfileForAquiferLayersSearch(); + SoilProfile1D actualSoilProfile = DetermineSoilProfileAtDikeTopAtPolder(); IList aquiferLayers = actualSoilProfile.GetAquiferLayers(); isNoLayerWithGivenType = layerType == LayerType.Aquifer ? aquiferLayers.Count == 0 : actualSoilProfile.Layers.Count - aquiferLayers.Count == 0; } @@ -180,7 +180,7 @@ } } - private SoilProfile1D GetSoilProfileBelowPoint(double xCoordinate) + private SoilProfile1D DetermineSoilProfileBelowPoint(double xCoordinate) { SoilProfile1D soilProfile1D; switch (SoilProfileType) @@ -197,10 +197,10 @@ return null; } } - - private SoilProfile1D GetRelevantSoilProfileForAquiferLayersSearch() + + private SoilProfile1D DetermineSoilProfileAtDikeTopAtPolder() { GeometryPoint relevantPoint = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - return GetSoilProfileBelowPoint(relevantPoint.X); + return DetermineSoilProfileBelowPoint(relevantPoint.X); } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx =================================================================== diff -u -r5427 -r5452 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 5427) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 5452) @@ -280,7 +280,7 @@ Er ontbreekt tenminste één van de volgende verplichte karakteristieke punten: Kruin buitentalud, Kruin binnentalud, Teen dijk binnenwaarts. - Er is niet voldoende informatie over het ondergrondprofiel (Profiel 1D, Profiel 2D of Ophoogmateriaal dijk) beschikbaar voor de PL-lijnen te maken. + Er is niet voldoende informatie over het ondergrondprofiel (Profiel 1D, Profiel 2D of Ophoogmateriaal dijk) beschikbaar om de PL-lijnen te maken. De onderste laag is geen (continue) watervoerende laag in ondergrondprofiel '{0}'. @@ -289,10 +289,10 @@ Ten minste één losse watervoerende laag aanwezig. - Het ondergrondprofiel bevat helemaal geen watervoerende laag. + Het ondergrondprofiel bevat geen watervoerende laag. - Het ondergrondprofiel bevat helemaal geen waterkerende laag. + Het ondergrondprofiel bevat geen waterkerende laag. Er is een onverwachte fout opgetreden bij het bepalen van de boven- en ondergrenzen van de tussenliggende watervoerende laag. Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx =================================================================== diff -u -r5427 -r5452 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 5427) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 5452) @@ -275,10 +275,10 @@ At least two surface line points are required. - At least one of the following required characteristic point is missing: Dike top at river, Dike top at polder, Dike toe at polder. + At least one of the following required characteristic points is missing: Dike top at river, Dike top at polder, Dike toe at polder. - Not enough soil geometry information (SoilProfile1D, SoilProfile2D or DikeEmbankmentMaterial) available for the PL-line creator. + Not enough soil geometry information (SoilProfile1D, SoilProfile2D or DikeEmbankmentMaterial) available to create the PL-lines. The deepest layer is not a (continuous) aquifer in soil profile '{0}'. @@ -287,10 +287,10 @@ At least one isolated aquifer is present. - The soil profile contains no aquifer layer at all. + The soil profile contains no aquifer layer. - The soil profile contains no aquitard layer at all. + The soil profile contains no aquitard layer. An unexpected error occured during the determination of the top and bottom boundaries of the in-between aquifer layer.