Index: DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile1DAquiferLayerCombinerTests.cs =================================================================== diff -u -r4000 -r4052 --- DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile1DAquiferLayerCombinerTests.cs (.../SoilProfile1DAquiferLayerCombinerTests.cs) (revision 4000) +++ DamEngine/trunk/src/Deltares.DamEngine.Data.Tests/Geotechnics/SoilProfile1DAquiferLayerCombinerTests.cs (.../SoilProfile1DAquiferLayerCombinerTests.cs) (revision 4052) @@ -22,100 +22,99 @@ using Deltares.DamEngine.Data.Geotechnics; using NUnit.Framework; -namespace Deltares.DamEngine.Data.Tests.Geotechnics +namespace Deltares.DamEngine.Data.Tests.Geotechnics; + +[TestFixture] +public class SoilProfile1DAquiferLayerCombinerTests { - [TestFixture] - public class SoilProfile1DAquiferLayerCombinerTests + [Test] + public void TestResultsOfCombinedLayers() { - [Test] - public void TestResultsOfCombinedLayers() - { - const double diff = 0.0001; - SoilProfile1D soilProfile1D = CreateProfile(); - var topLayerName = "L2"; - SoilProfile1DAquiferLayerCombiner.AquiferLayerProperties aquiferLayer = SoilProfile1DAquiferLayerCombiner.CombineLayers(soilProfile1D, topLayerName); - // D70 from layer L2 - Assert.AreEqual(0.0002, aquiferLayer.D70, diff); - // Height from L2 + all layers below it that are aquifer unless an aquitard is in between - // so sum of L2 and L3: 3 + 2 = 5 - Assert.AreEqual(5.0, aquiferLayer.Height, diff); - // PermeabilityKx is average of L2 and L3 based on height - // (0.0001 * 3 + 0.0006 * 2) / (3 + 2) = 0.0003 - Assert.AreEqual(0.0003, aquiferLayer.PermeabilityKx, diff); - } + const double diff = 0.0001; + SoilProfile1D soilProfile1D = CreateProfile(); + var topLayerName = "L2"; + SoilProfile1DAquiferLayerCombiner.AquiferLayerProperties aquiferLayer = SoilProfile1DAquiferLayerCombiner.CombineLayers(soilProfile1D, topLayerName); + // D70 from layer L2 + Assert.AreEqual(0.0002, aquiferLayer.D70, diff); + // Height from L2 + all layers below it that are aquifer unless an aquitard is in between + // so sum of L2 and L3: 3 + 2 = 5 + Assert.AreEqual(5.0, aquiferLayer.Height, diff); + // PermeabilityKx is average of L2 and L3 based on height + // (0.0001 * 3 + 0.0006 * 2) / (3 + 2) = 0.0003 + Assert.AreEqual(0.0003, aquiferLayer.PermeabilityKx, diff); + } - [Test] - [SetUICulture("nl-NL")] - public void TestThrowsExceptionWhenInterpolationModelIsNotTheSameForAllCombinedLayers() - { - SoilProfile1D soilProfile1D = CreateProfile(); - soilProfile1D.GetLayerWithName("L2").WaterpressureInterpolationModel = WaterpressureInterpolationModel.Automatic; - soilProfile1D.GetLayerWithName("L3").WaterpressureInterpolationModel = WaterpressureInterpolationModel.Hydrostatic; - soilProfile1D.Name = "Test Profile"; - var topLayerName = "L2"; - Assert.That(() => SoilProfile1DAquiferLayerCombiner.CombineLayers(soilProfile1D, topLayerName), Throws.InstanceOf().With.Message.EqualTo("Bij het samenstellen van de aquifer laag voor 1D profiel Test Profile hebben de samen te voegen lagen verschillende interpolatie methoden hetgeen niet is toegestaan.")); - } + [Test] + [SetUICulture("nl-NL")] + public void TestThrowsExceptionWhenInterpolationModelIsNotTheSameForAllCombinedLayers() + { + SoilProfile1D soilProfile1D = CreateProfile(); + soilProfile1D.GetLayerWithName("L2").WaterpressureInterpolationModel = WaterpressureInterpolationModel.Automatic; + soilProfile1D.GetLayerWithName("L3").WaterpressureInterpolationModel = WaterpressureInterpolationModel.Hydrostatic; + soilProfile1D.Name = "Test Profile"; + var topLayerName = "L2"; + Assert.That(() => SoilProfile1DAquiferLayerCombiner.CombineLayers(soilProfile1D, topLayerName), Throws.InstanceOf().With.Message.EqualTo("Bij het samenstellen van de aquifer laag voor 1D profiel Test Profile hebben de samen te voegen lagen verschillende interpolatie methoden hetgeen niet is toegestaan.")); + } - private static SoilProfile1D CreateProfile() - { - var soilProfile1D = new SoilProfile1D(); - soilProfile1D.BottomLevel = -12.0; + private static SoilProfile1D CreateProfile() + { + var soilProfile1D = new SoilProfile1D(); + soilProfile1D.BottomLevel = -12.0; - var soilLayer1 = new SoilLayer1D(); - soilLayer1.Name = "L0"; - soilLayer1.TopLevel = 13.0; - soilLayer1.Soil = new Soil("Sandy stuff", 22.0, 20.0); - soilLayer1.Soil.PermeabKx = 0.0004; - soilLayer1.Soil.DiameterD70 = 0.0005; - soilLayer1.IsAquifer = true; - soilProfile1D.Layers.Add(soilLayer1); + var soilLayer1 = new SoilLayer1D(); + soilLayer1.Name = "L0"; + soilLayer1.TopLevel = 13.0; + soilLayer1.Soil = new Soil("Sandy stuff", 22.0, 20.0); + soilLayer1.Soil.PermeabKx = 0.0004; + soilLayer1.Soil.DiameterD70 = 0.0005; + soilLayer1.IsAquifer = true; + soilProfile1D.Layers.Add(soilLayer1); - var soilLayer2 = new SoilLayer1D(); - soilLayer2.Name = "L1"; - soilLayer2.TopLevel = 10.0; - soilLayer2.Soil = new Soil("Topmaterial", 1.0, 1.0); - soilLayer2.Soil.PermeabKx = 0.0003; - soilLayer2.Soil.DiameterD70 = 0.0003; - soilLayer2.IsAquifer = false; - soilProfile1D.Layers.Add(soilLayer2); + var soilLayer2 = new SoilLayer1D(); + soilLayer2.Name = "L1"; + soilLayer2.TopLevel = 10.0; + soilLayer2.Soil = new Soil("Topmaterial", 1.0, 1.0); + soilLayer2.Soil.PermeabKx = 0.0003; + soilLayer2.Soil.DiameterD70 = 0.0003; + soilLayer2.IsAquifer = false; + soilProfile1D.Layers.Add(soilLayer2); - var soilLayer3 = new SoilLayer1D(); - soilLayer3.Name = "L2"; - soilLayer3.TopLevel = -2.0; - soilLayer3.Soil = new Soil("Sand", 22.0, 20.0); - soilLayer3.Soil.PermeabKx = 0.0001; - soilLayer3.Soil.DiameterD70 = 0.0002; - soilLayer3.IsAquifer = true; - soilProfile1D.Layers.Add(soilLayer3); + var soilLayer3 = new SoilLayer1D(); + soilLayer3.Name = "L2"; + soilLayer3.TopLevel = -2.0; + soilLayer3.Soil = new Soil("Sand", 22.0, 20.0); + soilLayer3.Soil.PermeabKx = 0.0001; + soilLayer3.Soil.DiameterD70 = 0.0002; + soilLayer3.IsAquifer = true; + soilProfile1D.Layers.Add(soilLayer3); - var soilLayer4 = new SoilLayer1D(); - soilLayer4.Name = "L3"; - soilLayer4.TopLevel = -5.0; - soilLayer4.Soil = new Soil("Also sand", 22.0, 20.0); - soilLayer4.Soil.PermeabKx = 0.0006; - soilLayer4.Soil.DiameterD70 = 0.0006; - soilLayer4.IsAquifer = true; - soilProfile1D.Layers.Add(soilLayer4); + var soilLayer4 = new SoilLayer1D(); + soilLayer4.Name = "L3"; + soilLayer4.TopLevel = -5.0; + soilLayer4.Soil = new Soil("Also sand", 22.0, 20.0); + soilLayer4.Soil.PermeabKx = 0.0006; + soilLayer4.Soil.DiameterD70 = 0.0006; + soilLayer4.IsAquifer = true; + soilProfile1D.Layers.Add(soilLayer4); - var soilLayer5 = new SoilLayer1D(); - soilLayer5.Name = "L4"; - soilLayer5.TopLevel = -7.0; - soilLayer5.Soil = new Soil("clay or so", 1.0, 1.0); - soilLayer5.Soil.PermeabKx = 0.0007; - soilLayer5.Soil.DiameterD70 = 0.0008; - soilLayer5.IsAquifer = false; - soilProfile1D.Layers.Add(soilLayer5); + var soilLayer5 = new SoilLayer1D(); + soilLayer5.Name = "L4"; + soilLayer5.TopLevel = -7.0; + soilLayer5.Soil = new Soil("clay or so", 1.0, 1.0); + soilLayer5.Soil.PermeabKx = 0.0007; + soilLayer5.Soil.DiameterD70 = 0.0008; + soilLayer5.IsAquifer = false; + soilProfile1D.Layers.Add(soilLayer5); - var soilLayer6 = new SoilLayer1D(); - soilLayer6.Name = "L4"; - soilLayer6.TopLevel = -8.0; - soilLayer6.Soil = new Soil("More sand", 22.0, 20.0); - soilLayer6.Soil.PermeabKx = 0.0009; - soilLayer6.Soil.DiameterD70 = 0.0010; - soilLayer6.IsAquifer = true; - soilProfile1D.Layers.Add(soilLayer6); + var soilLayer6 = new SoilLayer1D(); + soilLayer6.Name = "L4"; + soilLayer6.TopLevel = -8.0; + soilLayer6.Soil = new Soil("More sand", 22.0, 20.0); + soilLayer6.Soil.PermeabKx = 0.0009; + soilLayer6.Soil.DiameterD70 = 0.0010; + soilLayer6.IsAquifer = true; + soilProfile1D.Layers.Add(soilLayer6); - return soilProfile1D; - } + return soilProfile1D; } } \ No newline at end of file