Index: DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/SoilProfile2DImporterTest.cs =================================================================== diff -u -r3098 -r3283 --- DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/SoilProfile2DImporterTest.cs (.../SoilProfile2DImporterTest.cs) (revision 3098) +++ DamClients/DamUI/trunk/src/Dam/Tests/StiImporter/SoilProfile2DImporterTest.cs (.../SoilProfile2DImporterTest.cs) (revision 3283) @@ -26,8 +26,10 @@ using Deltares.Dam.Data.StiImporter; using NUnit.Framework; using Soil = Deltares.Geotechnics.Soils.Soil; +using SoilLayer2D = Deltares.Geotechnics.Soils.SoilLayer2D; using SoilList = Deltares.Geotechnics.Soils.SoilList; using SoilProfile2D = Deltares.Geotechnics.Soils.SoilProfile2D; +using GeotechnicsWaterPressureInterpolationModel = Deltares.Geotechnics.Soils.WaterpressureInterpolationModel; namespace Deltares.Dam.Tests.StiImporter { @@ -106,7 +108,8 @@ "Soft Clay", "Muck" }, soilProfileOne.Surfaces.Select(s => s.Name)); - + AssertSoilLayerProperties(availableSoils, soilProfileOne.Surfaces); + SoilProfile2D soilProfileTwo = soilProfiles.ElementAt(1); Assert.That(soilProfileTwo.Name, Is.EqualTo(profileTwoName)); CollectionAssert.AreEquivalent(new[] @@ -116,6 +119,7 @@ "Peat", "Soft Clay" }, soilProfileTwo.Surfaces.Select(s => s.Name)); // Check only whether all the surfaces are present as the order differs on different machines. + AssertSoilLayerProperties(availableSoils, soilProfileTwo.Surfaces); } [Test] @@ -150,7 +154,8 @@ "Soft Clay", "Muck" }, soilProfileOne.Surfaces.Select(s => s.Name)); - + AssertSoilLayerProperties(availableSoils, soilProfileOne.Surfaces); + SoilProfile2D soilProfileTwo = soilProfiles.ElementAt(1); Assert.That(soilProfileTwo.Name, Is.EqualTo(profileTwoFileName)); CollectionAssert.AreEquivalent(new[] @@ -160,6 +165,7 @@ "Peat", "Soft Clay" }, soilProfileTwo.Surfaces.Select(s => s.Name)); // Check only whether all the surfaces are present as the order differs on different machines. + AssertSoilLayerProperties(availableSoils, soilProfileTwo.Surfaces); } [Test] @@ -227,15 +233,35 @@ return segment; } + private static void AssertSoilLayerProperties(SoilList soils, IEnumerable soilLayers) + { + foreach (SoilLayer2D soilLayer in soilLayers) + { + Soil soil = soils.Soils.Single(s => string.Equals(s.Name, soilLayer.Name)); + bool expectedIsAquifer = soils.AquiferDictionary[soil]; + Assert.That(soilLayer.IsAquifer, Is.EqualTo(expectedIsAquifer)); + Assert.That(soilLayer.WaterpressureInterpolationModel, Is.EqualTo(GeotechnicsWaterPressureInterpolationModel.Automatic)); + } + } + private static SoilList CreateSoilList(IEnumerable soilNames) { - var soilList = new SoilList(); + var random = new Random(21); + var soilList = new SoilList + { + AquiferDictionary = new Dictionary() + }; + foreach (string soilName in soilNames) { - soilList.Add(new Soil + var soilToBeAdded = new Soil { Name = soilName - }); + }; + soilList.Add(soilToBeAdded); + + bool isAquifer = Convert.ToBoolean(random.Next(0, 2)); + soilList.AquiferDictionary.Add(soilToBeAdded, isAquifer); } return soilList; Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/SoilProfile2DImporter.cs =================================================================== diff -u -r3098 -r3283 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/SoilProfile2DImporter.cs (.../SoilProfile2DImporter.cs) (revision 3098) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/StiImporter/SoilProfile2DImporter.cs (.../SoilProfile2DImporter.cs) (revision 3283) @@ -78,6 +78,7 @@ throw new SoilProfileImporterException(string.Format(messageFormat, profileName)); } + TransferSoilLayerProperties(availableSoils, readSoilProfile.Surfaces); importedSoilProfiles.Add(readSoilProfile); } @@ -120,5 +121,14 @@ var soilNames = new HashSet(availableSoils.Soils.Select(s => s.Name)); return profile.Surfaces.All(soilLayer => soilNames.Contains(soilLayer.Name)); } + + private static void TransferSoilLayerProperties(SoilList availableSoils, IEnumerable soilLayers) + { + foreach (SoilLayer2D layer in soilLayers) + { + Soil soil = availableSoils.Soils.Single(s => string.Equals(s.Name, layer.Name)); + layer.IsAquifer = availableSoils.AquiferDictionary[soil]; + } + } } } \ No newline at end of file