Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityInwardsTests.cs =================================================================== diff -u -r1248 -r1259 --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 1248) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 1259) @@ -22,6 +22,7 @@ using System.IO; using System.Text.RegularExpressions; using Deltares.DamEngine.Data.General; +using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Io; @@ -728,16 +729,16 @@ // Design strategy: OptimizedSlopeAndShoulderAdaption // Set NewMinDistanceDikeToeStartDitch = 3.0, UseNewMinDistanceDikeToeStartDitch = true (to force value to be written to XML) // - // Parameters: CalcDir - StabilityModel - DesignStrategy - FoS - EntryPointX - ExitPointX - DikeLength - ShoulderHeight - Iterations - ResultMessage - [TestCase("TestStabInwardsBishopDesignSequential", "Bishop", "SlopeAdaptionBeforeShoulderAdaption", 1.444, 39.081, 67.577, 45.387, 2.799, 5, "")] - [TestCase("TestStabInwardsBishopDesignOptimized", "Bishop", "OptimizedSlopeAndShoulderAdaption", 1.412, 50.236, 67.077, 43.760, 3.889, 4, "")] - [TestCase("TestStabInwardsUpliftVanDesignSequential", "UpliftVan", "SlopeAdaptionBeforeShoulderAdaption", 1.414, 39.243, 73.587, 50.285, 3.465, 7, "")] - // Following testcase fails on DikeLength and ResultMessage - //[TestCase("TestStabInwardsUpliftVanDesignOptimized", "UpliftVan", "OptimizedSlopeAndShoulderAdaption", 1.156, 39.514, 66.926, 36.150, 0.0, 4, "FAIL: The new shoulder height with topslope exceeds the allowed maximum height.")] + // Parameters: CalcDir - StabilityModel - DesignStrategy - CalculationResult - FoS - EntryPointX - ExitPointX - DikeLength - ShoulderHeight - Iterations - ResultMessage + [TestCase("TestStabInwardsBishopDesignSequential", "Bishop", "SlopeAdaptionBeforeShoulderAdaption", CalculationResult.Succeeded, 1.444, 39.081, 67.577, 45.387, 2.799, 5, "")] + [TestCase("TestStabInwardsBishopDesignOptimized", "Bishop", "OptimizedSlopeAndShoulderAdaption", CalculationResult.Succeeded, 1.412, 50.236, 67.077, 43.760, 3.889, 4, "")] + [TestCase("TestStabInwardsUpliftVanDesignSequential", "UpliftVan", "SlopeAdaptionBeforeShoulderAdaption", CalculationResult.Succeeded, 1.414, 39.243, 73.587, 50.285, 3.465, 7, "")] + [TestCase("TestStabInwardsUpliftVanDesignOptimized", "UpliftVan", "OptimizedSlopeAndShoulderAdaption", CalculationResult.RunFailed, 1.156, 39.514, 66.926, 36.150, 0.0, 4, "FAIL: The new shoulder height with topslope exceeds the allowed maximum height.")] public void CanPerformStabilityInwardsDesignTutorialDesignOptimizedSlopeAndShoulderAdaption_OneLocation( string calcDir, string stabilityModel, string designStrategy, - double expectedSafetyFactor, double expectedZone1EntryPointX, double expectedZone1ExitPointX, - double expectedDikeLength, double expectedShoulderHeight, + CalculationResult calculationResult, double expectedSafetyFactor, + double expectedZone1EntryPointX, double expectedZone1ExitPointX, + double expectedDikeLength, double expectedShoulderHeight, int expectedNumberOfIterations, string expectedResultMessage) { const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile1LocationWithAdaption.xml"; @@ -757,17 +758,26 @@ var output = DamXmlSerialization.LoadOutputFromXmlString(outputString); DamProjectData actualDamProjectData = FillDamFromXmlOutput.CreateDamProjectData(null, output); - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults.DesignResults[0].CalculationResult)); - SurfaceLine2 redesignedSurfaceLine = actualDamProjectData.DesignCalculations[0].StabilityDesignResults.RedesignedSurfaceLine; + Assert.AreEqual(calculationResult, ConversionHelper.ConvertToCalculationResult( + output.Results.CalculationResults.DesignResults[0].CalculationResult)); - Assert.AreEqual(expectedSafetyFactor, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.SafetyFactor, tolerance); - Assert.AreEqual(expectedSafetyFactor, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone1SafetyFactor, tolerance); - Assert.AreEqual(expectedZone1EntryPointX, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone1EntryPointX, tolerance); - Assert.AreEqual(expectedZone1ExitPointX, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone1ExitPointX, tolerance); - Assert.AreEqual(expectedDikeLength, redesignedSurfaceLine.GetDikeLength(), tolerance); - // Assert.AreEqual(expectedShoulderHeight, ???, tolerance); // TODO: do not know yet how to determine shoulderheight - Assert.AreEqual(expectedNumberOfIterations, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.NumberOfIterations); - Assert.AreEqual(expectedResultMessage, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.ResultMessage); + var stabilityDesignResults = output.Results.CalculationResults.DesignResults[0].StabilityDesignResults; + Assert.AreEqual(expectedSafetyFactor, stabilityDesignResults.SafetyFactor, tolerance); + Assert.AreEqual(expectedSafetyFactor, stabilityDesignResults.Zone1SafetyFactor, tolerance); + Assert.AreEqual(expectedZone1EntryPointX, stabilityDesignResults.Zone1EntryPointX, tolerance); + Assert.AreEqual(expectedZone1ExitPointX, stabilityDesignResults.Zone1ExitPointX, tolerance); + Assert.AreEqual(expectedNumberOfIterations, stabilityDesignResults.NumberOfIterations); + Assert.AreEqual(expectedResultMessage, stabilityDesignResults.ResultMessage); + SurfaceLine2 redesignedSurfaceLine = actualDamProjectData.DesignCalculations[0].StabilityDesignResults.RedesignedSurfaceLine; + if (redesignedSurfaceLine != null) + { + Assert.AreEqual(expectedDikeLength, redesignedSurfaceLine.GetDikeLength(), tolerance); + GeometryPoint pointShoulderBaseInside = redesignedSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); + if (pointShoulderBaseInside != null) + { + Assert.AreEqual(expectedShoulderHeight, pointShoulderBaseInside.Z, tolerance); + } + } } [Test, Category("Slow")]