Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj =================================================================== diff -u -r1941 -r1944 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj (.../Deltares.DamEngine.Calculators.Tests.csproj) (revision 1941) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj (.../Deltares.DamEngine.Calculators.Tests.csproj) (revision 1944) @@ -53,6 +53,7 @@ + Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/Common/UpliftHelperTests.cs =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/Common/UpliftHelperTests.cs (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/Common/UpliftHelperTests.cs (revision 1944) @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Deltares.DamEngine.Calculators.KernelWrappers.Common; +using Deltares.DamEngine.Calculators.Tests.KernelWrappers.DamMacroStabilityCommon; +using Deltares.DamEngine.Data.General; +using Deltares.DamEngine.TestHelpers.Factories; +using NUnit.Framework; + +namespace Deltares.DamEngine.Calculators.Tests.KernelWrappers.Common +{ + public class UpliftHelperTests + { + + [Test] + public void TestDetermineStabilityUplift() + { + const double diff = 0.01; + + var damKernelInput = CreateDamKernelInput(); + damKernelInput.Location.ModelFactors.UpliftCriterionStability = 1.2; + var upliftSituation = UpliftHelper.DetermineStabilityUplift(damKernelInput, false); + Assert.IsTrue(upliftSituation.IsUplift); + Assert.IsTrue(1.7e308 < upliftSituation.Pl3HeadAdjusted); + Assert.IsTrue(1.7e308 < upliftSituation.Pl3LocationXMinUplift); + Assert.IsTrue(1.7e308 < upliftSituation.Pl3MinUplift); + Assert.AreEqual(0, upliftSituation.Pl4HeadAdjusted, diff); + Assert.AreEqual(59.5, upliftSituation.Pl4LocationXMinUplift, diff); + Assert.AreEqual(1, upliftSituation.Pl4MinUplift, diff); + + damKernelInput.Location.ModelFactors.UpliftCriterionStability = 0.8; + upliftSituation = UpliftHelper.DetermineStabilityUplift(damKernelInput, false); + Assert.IsFalse(upliftSituation.IsUplift); + } + + private static DamKernelInput CreateDamKernelInput() + { + const string testFolder = + @"..\..\Deltares.DamEngine.Calculators.Tests\KernelWrappers\DamMacroStabilityCommon\TestData"; + + var absoluteFolder = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), testFolder)); + var projectPath = Path.Combine(absoluteFolder, "testProjectMap"); + var soilDbName = Path.Combine(projectPath, "testSoilMaterials.mdb"); + var geometryFolder = "testGeomMap"; + var geometryPath = Path.Combine(projectPath, geometryFolder); + var soilGeometry2DName = "test1D1.sti"; + + var location = DamMacroStabilityTestHelper.CreateLocation(FactoryForSurfaceLines.CreateSurfaceLineTutorial1()); + location.StabilityOptions = new StabilityOptions(); + location.StabilityOptions.TrafficLoad = 10.0; + location.StabilityOptions.SoilGeometries2DPath = geometryPath; + location.StabilityOptions.SoilDatabaseName = soilDbName; + location.ModelFactors.RequiredSafetyFactorStabilityInnerSlope = 1.1; + + var subSoilScenario = new SoilGeometryProbability(); + subSoilScenario.StiFileName = soilGeometry2DName; + subSoilScenario.SoilProfileType = SoilProfileType.ProfileTypeStiFile; + subSoilScenario.SegmentFailureMechanismType = FailureMechanismSystemType.StabilityInside; + subSoilScenario.FullStiFileName = Path.Combine(projectPath, + Path.Combine(location.StabilityOptions.SoilGeometries2DPath, subSoilScenario.StiFileName)); + + var damKernelInput = new DamKernelInput(); + damKernelInput.Location = location; + damKernelInput.SubSoilScenario = subSoilScenario; + damKernelInput.ProjectDir = projectPath; + damKernelInput.RiverLevelLow = null; + damKernelInput.DamFailureMechanismeCalculationSpecification = new DamFailureMechanismeCalculationSpecification(); + + return damKernelInput; + } + } +}