Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs =================================================================== diff -u -r4000 -r4052 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 4000) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 4052) @@ -36,1043 +36,1042 @@ using ConversionHelper = Deltares.DamEngine.Interface.ConversionHelper; using UpliftSituation = Deltares.DamEngine.Io.XmlOutput.UpliftSituation; -namespace Deltares.DamEngine.IntegrationTests.IntegrationTests +namespace Deltares.DamEngine.IntegrationTests.IntegrationTests; + +[TestFixture] +public class MacroStabilityInwardsTests { - [TestFixture] - public class MacroStabilityInwardsTests + private const double Tolerance = 0.0005; + + [TearDown] + public void TearDown() { - private const double Tolerance = 0.0005; + // Ensure clearing directories at end. + RemoveUsedDirectoryAfterTests("TestStabInwardsBishop"); + RemoveUsedDirectoryAfterTests("TestStabInwardsUpliftVan"); + RemoveUsedDirectoryAfterTests("TestStabInwardsBishopUpliftVan_UpliftVanLowest"); + RemoveUsedDirectoryAfterTests("TestStabInwardsBishopUpliftVan_BishopLowest"); + RemoveUsedDirectoryAfterTests("TestStabInwardsBishopUpliftVan_NoUplift"); + RemoveUsedDirectoryAfterTests("TestStabInwardsForbiddenZoneBishop"); + RemoveUsedDirectoryAfterTests("TestStabInwardsWithErrorUpliftVan"); + RemoveUsedDirectoryAfterTests("TestStabInwardsWithErrorBishopUpliftVan"); + RemoveUsedDirectoryAfterTests("TestRunFailedExpectCalculationMessageInOptimizedSlopeAndShoulderAdaption"); + RemoveUsedDirectoryAfterTests("TestRunFailedExpectCalculationMessageInSlopeAdaptionBeforeShoulderAdaption"); + RemoveUsedDirectoryAfterTests("TestGiveFeedBackWhenNoProfilesAreAvailable"); + RemoveUsedDirectoryAfterTests("TestStabInwardsBishopWithStixFiles"); + RemoveUsedDirectoryAfterTests("TestStabInwardsUpliftVanWithStixFiles"); + RemoveUsedDirectoryAfterTests("TestStabInwardsBishopUpliftVanWithUpliftWithStixFiles"); + RemoveUsedDirectoryAfterTests("TestStabInwardsBishopUpliftVanWithoutUpliftWithStixFiles"); + } - [TearDown] - public void TearDown() + /// Test for different segmentFailureMechanismType + /// The soilprobabilities are set tot the specified segmentFailureMechanismType + [Test, Category("Slow")] + [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] + [TestCase(ConversionHelper.InputSegmentFailureMechanismStability)] + [TestCase(ConversionHelper.InputSegmentFailureMechanismAll)] + public void TestRunMacroStabilityTutorialDesignBishop(int segmentFailureMechanismType) + { + // Based on ".data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx" + // with Dam Classic rev.1059 + // Set Analysis type to "No adaption" + // Select 1st location (DWP_1) + // Set Calculation Options: Stability Inside - Bishop + // Expected results are determined by running dam\dam clients\DamUI\trunk\data\DamEngineTestProjects\DAM Tutorial Design + // with Dam Classic rev.833 + const string calcDir = "TestStabInwardsBishop"; + if (Directory.Exists(calcDir)) { - // Ensure clearing directories at end. - RemoveUsedDirectoryAfterTests("TestStabInwardsBishop"); - RemoveUsedDirectoryAfterTests("TestStabInwardsUpliftVan"); - RemoveUsedDirectoryAfterTests("TestStabInwardsBishopUpliftVan_UpliftVanLowest"); - RemoveUsedDirectoryAfterTests("TestStabInwardsBishopUpliftVan_BishopLowest"); - RemoveUsedDirectoryAfterTests("TestStabInwardsBishopUpliftVan_NoUplift"); - RemoveUsedDirectoryAfterTests("TestStabInwardsForbiddenZoneBishop"); - RemoveUsedDirectoryAfterTests("TestStabInwardsWithErrorUpliftVan"); - RemoveUsedDirectoryAfterTests("TestStabInwardsWithErrorBishopUpliftVan"); - RemoveUsedDirectoryAfterTests("TestRunFailedExpectCalculationMessageInOptimizedSlopeAndShoulderAdaption"); - RemoveUsedDirectoryAfterTests("TestRunFailedExpectCalculationMessageInSlopeAdaptionBeforeShoulderAdaption"); - RemoveUsedDirectoryAfterTests("TestGiveFeedBackWhenNoProfilesAreAvailable"); - RemoveUsedDirectoryAfterTests("TestStabInwardsBishopWithStixFiles"); - RemoveUsedDirectoryAfterTests("TestStabInwardsUpliftVanWithStixFiles"); - RemoveUsedDirectoryAfterTests("TestStabInwardsBishopUpliftVanWithUpliftWithStixFiles"); - RemoveUsedDirectoryAfterTests("TestStabInwardsBishopUpliftVanWithoutUpliftWithStixFiles"); + Directory.Delete(calcDir, true); // delete previous results } - /// Test for different segmentFailureMechanismType - /// The soilprobabilities are set tot the specified segmentFailureMechanismType - [Test, Category("Slow")] - [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] - [TestCase(ConversionHelper.InputSegmentFailureMechanismStability)] - [TestCase(ConversionHelper.InputSegmentFailureMechanismAll)] - public void TestRunMacroStabilityTutorialDesignBishop(int segmentFailureMechanismType) - { - // Based on ".data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx" - // with Dam Classic rev.1059 - // Set Analysis type to "No adaption" - // Select 1st location (DWP_1) - // Set Calculation Options: Stability Inside - Bishop - // Expected results are determined by running dam\dam clients\DamUI\trunk\data\DamEngineTestProjects\DAM Tutorial Design - // with Dam Classic rev.833 - const string calcDir = "TestStabInwardsBishop"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + Directory.CreateDirectory(calcDir); - Directory.CreateDirectory(calcDir); + const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile.xml"; + string inputString = File.ReadAllText(fileName); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SegmentFailureMechanismType", segmentFailureMechanismType.ToString()); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile.xml"; - string inputString = File.ReadAllText(fileName); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SegmentFailureMechanismType", segmentFailureMechanismType.ToString()); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); - string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.IsNotNull(output.Results.CalculationResults, "No results available"); + Assert.AreEqual(1.282, output.Results.CalculationResults[0].StabilityDesignResults.SafetyFactor, Tolerance); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - Assert.IsNotNull(output.Results.CalculationResults, "No results available"); - Assert.AreEqual(1.282, output.Results.CalculationResults[0].StabilityDesignResults.SafetyFactor, Tolerance); + // NumberOfIterations=0 + Assert.AreEqual(0, output.Results.CalculationResults[0].StabilityDesignResults.NumberOfIterations); + // ResultMessage "" + Assert.AreEqual("", output.Results.CalculationResults[0].StabilityDesignResults.ResultMessage); - // NumberOfIterations=0 - Assert.AreEqual(0, output.Results.CalculationResults[0].StabilityDesignResults.NumberOfIterations); - // ResultMessage "" - Assert.AreEqual("", output.Results.CalculationResults[0].StabilityDesignResults.ResultMessage); + // Check that a line is specified + Assert.IsNotNull(output.Results.CalculationResults[0].StabilityDesignResults.RedesignedSurfaceLine); - // Check that a line is specified - Assert.IsNotNull(output.Results.CalculationResults[0].StabilityDesignResults.RedesignedSurfaceLine); + // Profile name = DWP_1.sti + Assert.AreEqual("DWP_1.sti", output.Results.CalculationResults[0].ProfileName); - // Profile name = DWP_1.sti - Assert.AreEqual("DWP_1.sti", output.Results.CalculationResults[0].ProfileName); + // Uplift + UpliftSituation upliftSituation = output.Results.CalculationResults[0].StabilityDesignResults.UpliftSituation; + Assert.IsNotNull(upliftSituation); + Assert.AreEqual(true, upliftSituation.IsUplift); + Assert.AreEqual(1.141, upliftSituation.Pl3MinUplift, Tolerance); + Assert.AreEqual(4.4, upliftSituation.Pl3HeadAdjusted, Tolerance); + Assert.AreEqual(60.64, upliftSituation.Pl3LocationXMinUplift, Tolerance); + Assert.AreEqual(0.0, upliftSituation.Pl4MinUplift, Tolerance); + Assert.AreEqual(0.0, upliftSituation.Pl4HeadAdjusted, Tolerance); + Assert.AreEqual(0.0, upliftSituation.Pl4LocationXMinUplift, Tolerance); - // Uplift - UpliftSituation upliftSituation = output.Results.CalculationResults[0].StabilityDesignResults.UpliftSituation; - Assert.IsNotNull(upliftSituation); - Assert.AreEqual(true, upliftSituation.IsUplift); - Assert.AreEqual(1.141, upliftSituation.Pl3MinUplift, Tolerance); - Assert.AreEqual(4.4, upliftSituation.Pl3HeadAdjusted, Tolerance); - Assert.AreEqual(60.64, upliftSituation.Pl3LocationXMinUplift, Tolerance); - Assert.AreEqual(0.0, upliftSituation.Pl4MinUplift, Tolerance); - Assert.AreEqual(0.0, upliftSituation.Pl4HeadAdjusted, Tolerance); - Assert.AreEqual(0.0, upliftSituation.Pl4LocationXMinUplift, Tolerance); + // Calculation Result + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[0].CalculationResult)); + } - // Calculation Result - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[0].CalculationResult)); + [Test, Category("Slow")] + [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] + public void TestRunMacroStabilityTutorialDesignUpliftVan() + { + // Based on ".data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx" + // with Dam Classic rev.1059 + // Select 1st location (DWP_1) + // with Dam Classic rev.833 + const string calcDir = "TestStabInwardsUpliftVan"; + if (Directory.Exists(calcDir)) + { + Directory.Delete(calcDir, true); // delete previous results } - [Test, Category("Slow")] - [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] - public void TestRunMacroStabilityTutorialDesignUpliftVan() - { - // Based on ".data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx" - // with Dam Classic rev.1059 - // Select 1st location (DWP_1) - // with Dam Classic rev.833 - const string calcDir = "TestStabInwardsUpliftVan"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile.xml"; + string inputString = File.ReadAllText(fileName); + inputString = ChangeInputModel(inputString, InputStabilityModelType.UpliftVan); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile.xml"; - string inputString = File.ReadAllText(fileName); - inputString = ChangeInputModel(inputString, InputStabilityModelType.UpliftVan); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); - string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.AreEqual(1.115, output.Results.CalculationResults[0].StabilityDesignResults.SafetyFactor, Tolerance); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - Assert.AreEqual(1.115, output.Results.CalculationResults[0].StabilityDesignResults.SafetyFactor, Tolerance); + // NumberOfIterations=0 + Assert.AreEqual(0, output.Results.CalculationResults[0].StabilityDesignResults.NumberOfIterations); + // ResultMessage "" + Assert.AreEqual("", output.Results.CalculationResults[0].StabilityDesignResults.ResultMessage); - // NumberOfIterations=0 - Assert.AreEqual(0, output.Results.CalculationResults[0].StabilityDesignResults.NumberOfIterations); - // ResultMessage "" - Assert.AreEqual("", output.Results.CalculationResults[0].StabilityDesignResults.ResultMessage); + // Check that a line is specified + Assert.IsNotNull(output.Results.CalculationResults[0].StabilityDesignResults.RedesignedSurfaceLine); - // Check that a line is specified - Assert.IsNotNull(output.Results.CalculationResults[0].StabilityDesignResults.RedesignedSurfaceLine); + // Profile name = DWP_1.sti + Assert.AreEqual("DWP_1.sti", output.Results.CalculationResults[0].ProfileName); - // Profile name = DWP_1.sti - Assert.AreEqual("DWP_1.sti", output.Results.CalculationResults[0].ProfileName); + // Uplift + UpliftSituation upliftSituation = output.Results.CalculationResults[0].StabilityDesignResults.UpliftSituation; + Assert.IsNotNull(upliftSituation); + Assert.AreEqual(true, upliftSituation.IsUplift); + Assert.AreEqual(1.141, upliftSituation.Pl3MinUplift, Tolerance); + Assert.AreEqual(4.4, upliftSituation.Pl3HeadAdjusted, Tolerance); + Assert.AreEqual(60.64, upliftSituation.Pl3LocationXMinUplift, Tolerance); + Assert.AreEqual(0.0, upliftSituation.Pl4MinUplift, Tolerance); + Assert.AreEqual(0.0, upliftSituation.Pl4HeadAdjusted, Tolerance); + Assert.AreEqual(0.0, upliftSituation.Pl4LocationXMinUplift, Tolerance); - // Uplift - UpliftSituation upliftSituation = output.Results.CalculationResults[0].StabilityDesignResults.UpliftSituation; - Assert.IsNotNull(upliftSituation); - Assert.AreEqual(true, upliftSituation.IsUplift); - Assert.AreEqual(1.141, upliftSituation.Pl3MinUplift, Tolerance); - Assert.AreEqual(4.4, upliftSituation.Pl3HeadAdjusted, Tolerance); - Assert.AreEqual(60.64, upliftSituation.Pl3LocationXMinUplift, Tolerance); - Assert.AreEqual(0.0, upliftSituation.Pl4MinUplift, Tolerance); - Assert.AreEqual(0.0, upliftSituation.Pl4HeadAdjusted, Tolerance); - Assert.AreEqual(0.0, upliftSituation.Pl4LocationXMinUplift, Tolerance); + // Calculation Result + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[0].CalculationResult)); + } - // Calculation Result - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[0].CalculationResult)); + [Test, Category("Slow")] + [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] + public void TestRunMacroStabilityTutorialDesignBishopUpliftVan_UpliftVanLowest() + { + // Based on ".data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx" + // with Dam Classic rev.1059 + // Select 1st location (DWP_1) + // with Dam Classic rev.833 + const string calcDir = "TestStabInwardsBishopUpliftVan_UpliftVanLowest"; + if (Directory.Exists(calcDir)) + { + Directory.Delete(calcDir, true); // delete previous results } - [Test, Category("Slow")] - [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] - public void TestRunMacroStabilityTutorialDesignBishopUpliftVan_UpliftVanLowest() - { - // Based on ".data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx" - // with Dam Classic rev.1059 - // Select 1st location (DWP_1) - // with Dam Classic rev.833 - const string calcDir = "TestStabInwardsBishopUpliftVan_UpliftVanLowest"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile.xml"; + string inputString = File.ReadAllText(fileName); + inputString = ChangeInputModel(inputString, InputStabilityModelType.BishopUpliftVan); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile.xml"; - string inputString = File.ReadAllText(fileName); - inputString = ChangeInputModel(inputString, InputStabilityModelType.BishopUpliftVan); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); - string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + // Bishop + DesignResult result = output.Results.CalculationResults[0]; + Assert.AreEqual(1.282, result.StabilityDesignResults.SafetyFactor, Tolerance); + Assert.IsNotNull(result.StabilityDesignResults.UpliftSituation); + Assert.IsTrue(result.StabilityDesignResults.UpliftSituation.IsUplift); + Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.Bishop, result.StabilityDesignResults.StabilityModelType); + Assert.AreEqual("Loc(DWP_1)_Sce(1)_Pro(DWP_1)", result.BaseFileName); + // Uplift Van + result = output.Results.CalculationResults[1]; + Assert.AreEqual(1.115, result.StabilityDesignResults.SafetyFactor, Tolerance); + Assert.IsNotNull(result.StabilityDesignResults.UpliftSituation); + Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.UpliftVan, result.StabilityDesignResults.StabilityModelType); + Assert.AreEqual("Loc(DWP_1)_Sce(1)_Pro(DWP_1)", result.BaseFileName); + // Worst of Bishop and Uplift Van + result = output.Results.CalculationResults[2]; + Assert.AreEqual(1.115, result.StabilityDesignResults.SafetyFactor, Tolerance); + Assert.IsNotNull(result.StabilityDesignResults.UpliftSituation); + Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan, result.StabilityDesignResults.StabilityModelType); + Assert.AreEqual("Loc(DWP_1)_Sce(1)_Pro(DWP_1)", result.BaseFileName); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - // Bishop - DesignResult result = output.Results.CalculationResults[0]; - Assert.AreEqual(1.282, result.StabilityDesignResults.SafetyFactor, Tolerance); - Assert.IsNotNull(result.StabilityDesignResults.UpliftSituation); - Assert.IsTrue(result.StabilityDesignResults.UpliftSituation.IsUplift); - Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.Bishop, result.StabilityDesignResults.StabilityModelType); - Assert.AreEqual("Loc(DWP_1)_Sce(1)_Pro(DWP_1)", result.BaseFileName); - // Uplift Van - result = output.Results.CalculationResults[1]; - Assert.AreEqual(1.115, result.StabilityDesignResults.SafetyFactor, Tolerance); - Assert.IsNotNull(result.StabilityDesignResults.UpliftSituation); - Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.UpliftVan, result.StabilityDesignResults.StabilityModelType); - Assert.AreEqual("Loc(DWP_1)_Sce(1)_Pro(DWP_1)", result.BaseFileName); - // Worst of Bishop and Uplift Van - result = output.Results.CalculationResults[2]; - Assert.AreEqual(1.115, result.StabilityDesignResults.SafetyFactor, Tolerance); - Assert.IsNotNull(result.StabilityDesignResults.UpliftSituation); - Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan, result.StabilityDesignResults.StabilityModelType); - Assert.AreEqual("Loc(DWP_1)_Sce(1)_Pro(DWP_1)", result.BaseFileName); + // Calculation Result + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[0].CalculationResult)); + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[1].CalculationResult)); + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[2].CalculationResult)); + } - // Calculation Result - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[0].CalculationResult)); - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[1].CalculationResult)); - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[2].CalculationResult)); + [Test, Category("Slow")] + [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] + public void TestRunMacroStabilityTutorialDesignBishopUpliftVan_BishopLowest() + { + // Based on ".data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx" + // with Dam Classic rev.1059 + // Select 5th location (DWP_13) + // with Dam Classic rev.833 + const string calcDir = "TestStabInwardsBishopUpliftVan_BishopLowest"; + if (Directory.Exists(calcDir)) + { + Directory.Delete(calcDir, true); // delete previous results } - [Test, Category("Slow")] - [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] - public void TestRunMacroStabilityTutorialDesignBishopUpliftVan_BishopLowest() - { - // Based on ".data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx" - // with Dam Classic rev.1059 - // Select 5th location (DWP_13) - // with Dam Classic rev.833 - const string calcDir = "TestStabInwardsBishopUpliftVan_BishopLowest"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile13.xml"; + string inputString = File.ReadAllText(fileName); + inputString = ChangeInputModel(inputString, InputStabilityModelType.BishopUpliftVan); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile13.xml"; - string inputString = File.ReadAllText(fileName); - inputString = ChangeInputModel(inputString, InputStabilityModelType.BishopUpliftVan); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); - string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + // Bishop + DesignResultStabilityDesignResults result = output.Results.CalculationResults[0].StabilityDesignResults; + Assert.AreEqual(0.452, result.SafetyFactor, Tolerance); + Assert.IsNotNull(result.UpliftSituation); + Assert.IsTrue(result.UpliftSituation.IsUplift); + Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.Bishop, result.StabilityModelType); + // Uplift Van + result = output.Results.CalculationResults[1].StabilityDesignResults; + Assert.AreEqual(0.574, result.SafetyFactor, Tolerance); + Assert.IsNotNull(result.UpliftSituation); + Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.UpliftVan, result.StabilityModelType); + // Worst of Bishop and Uplift Van + result = output.Results.CalculationResults[2].StabilityDesignResults; + Assert.AreEqual(0.452, result.SafetyFactor, Tolerance); + Assert.IsNotNull(result.UpliftSituation); + Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan, result.StabilityModelType); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - // Bishop - DesignResultStabilityDesignResults result = output.Results.CalculationResults[0].StabilityDesignResults; - Assert.AreEqual(0.452, result.SafetyFactor, Tolerance); - Assert.IsNotNull(result.UpliftSituation); - Assert.IsTrue(result.UpliftSituation.IsUplift); - Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.Bishop, result.StabilityModelType); - // Uplift Van - result = output.Results.CalculationResults[1].StabilityDesignResults; - Assert.AreEqual(0.574, result.SafetyFactor, Tolerance); - Assert.IsNotNull(result.UpliftSituation); - Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.UpliftVan, result.StabilityModelType); - // Worst of Bishop and Uplift Van - result = output.Results.CalculationResults[2].StabilityDesignResults; - Assert.AreEqual(0.452, result.SafetyFactor, Tolerance); - Assert.IsNotNull(result.UpliftSituation); - Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan, result.StabilityModelType); + // Calculation Result + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[0].CalculationResult)); + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[1].CalculationResult)); + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[2].CalculationResult)); + } - // Calculation Result - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[0].CalculationResult)); - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[1].CalculationResult)); - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[2].CalculationResult)); + [Test, Category("Slow")] + [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] + public void TestRunMacroStabilityTutorialDesignBishopUpliftVan_NoUplift() + { + // Based on ".data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx" + // with Dam Classic rev.1059 + // Select 10th location (DWP_18) + // with Dam Classic rev.833 + const string calcDir = "TestStabInwardsBishopUpliftVan_NoUplift"; + if (Directory.Exists(calcDir)) + { + Directory.Delete(calcDir, true); // delete previous results } - [Test, Category("Slow")] - [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] - public void TestRunMacroStabilityTutorialDesignBishopUpliftVan_NoUplift() - { - // Based on ".data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx" - // with Dam Classic rev.1059 - // Select 10th location (DWP_18) - // with Dam Classic rev.833 - const string calcDir = "TestStabInwardsBishopUpliftVan_NoUplift"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile18.xml"; + string inputString = File.ReadAllText(fileName); + inputString = ChangeInputModel(inputString, InputStabilityModelType.BishopUpliftVan); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile18.xml"; - string inputString = File.ReadAllText(fileName); - inputString = ChangeInputModel(inputString, InputStabilityModelType.BishopUpliftVan); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); - string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + // Bishop + DesignResultStabilityDesignResults result = output.Results.CalculationResults[0].StabilityDesignResults; + Assert.IsTrue(result.SafetyFactorSpecified); + Assert.AreEqual(1.458, result.SafetyFactor, Tolerance); + Assert.IsNotNull(result.UpliftSituation); + Assert.IsFalse(result.UpliftSituation.IsUplift); + Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.Bishop, result.StabilityModelType); + // Uplift Van + result = output.Results.CalculationResults[1].StabilityDesignResults; + Assert.IsFalse(result.SafetyFactorSpecified); + Assert.IsNotNull(result.UpliftSituation); + Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.UpliftVan, result.StabilityModelType); + // Worst of Bishop and Uplift Van + result = output.Results.CalculationResults[2].StabilityDesignResults; + Assert.IsTrue(result.SafetyFactorSpecified); + Assert.AreEqual(1.458, result.SafetyFactor, Tolerance); + Assert.IsNotNull(result.UpliftSituation); + Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan, result.StabilityModelType); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - // Bishop - DesignResultStabilityDesignResults result = output.Results.CalculationResults[0].StabilityDesignResults; - Assert.IsTrue(result.SafetyFactorSpecified); - Assert.AreEqual(1.458, result.SafetyFactor, Tolerance); - Assert.IsNotNull(result.UpliftSituation); - Assert.IsFalse(result.UpliftSituation.IsUplift); - Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.Bishop, result.StabilityModelType); - // Uplift Van - result = output.Results.CalculationResults[1].StabilityDesignResults; - Assert.IsFalse(result.SafetyFactorSpecified); - Assert.IsNotNull(result.UpliftSituation); - Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.UpliftVan, result.StabilityModelType); - // Worst of Bishop and Uplift Van - result = output.Results.CalculationResults[2].StabilityDesignResults; - Assert.IsTrue(result.SafetyFactorSpecified); - Assert.AreEqual(1.458, result.SafetyFactor, Tolerance); - Assert.IsNotNull(result.UpliftSituation); - Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan, result.StabilityModelType); + // Calculation Result + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[0].CalculationResult)); + Assert.AreEqual(CalculationResult.NoRun, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[1].CalculationResult)); + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[2].CalculationResult)); + } - // Calculation Result - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[0].CalculationResult)); - Assert.AreEqual(CalculationResult.NoRun, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[1].CalculationResult)); - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[2].CalculationResult)); - } + [Test, Category("Slow")] + [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] + public void TestRunMacroStabilityInvoer10ForbiddenZoneBishop() + { + // Expected results are determined by running dam\dam clients\DamUI\trunk\data\DamEngineTestProjects\Invoer10\ZoneType.damx + // with Dam Classic rev.1059 + // Select locations DWP_10_2 and DWP_10_6 + // Analysis type "No adaption" + // Calculation options: Stability Inside - Bishop + // This tests two locations with same profile + // But first location with Zone Areas and second location with Forbidden Zone - [Test, Category("Slow")] - [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] - public void TestRunMacroStabilityInvoer10ForbiddenZoneBishop() + // Note: this test might be activated again in the future as Forbidden zone seems to be supported by the new kernel. But then all new reference values are needed. + const string calcDir = "TestStabInwardsForbiddenZoneBishop"; + if (Directory.Exists(calcDir)) { - // Expected results are determined by running dam\dam clients\DamUI\trunk\data\DamEngineTestProjects\Invoer10\ZoneType.damx - // with Dam Classic rev.1059 - // Select locations DWP_10_2 and DWP_10_6 - // Analysis type "No adaption" - // Calculation options: Stability Inside - Bishop - // This tests two locations with same profile - // But first location with Zone Areas and second location with Forbidden Zone + Directory.Delete(calcDir, true); // delete previous results + } - // Note: this test might be activated again in the future as Forbidden zone seems to be supported by the new kernel. But then all new reference values are needed. - const string calcDir = "TestStabInwardsForbiddenZoneBishop"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + Directory.CreateDirectory(calcDir); - Directory.CreateDirectory(calcDir); + const string fileName = @"TestFiles\Invoer10.xml"; + string inputString = File.ReadAllText(fileName); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\ZoneType.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\ZoneType0.soilmaterials.mdb"); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - const string fileName = @"TestFiles\Invoer10.xml"; - string inputString = File.ReadAllText(fileName); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\ZoneType.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\ZoneType0.soilmaterials.mdb"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); - string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.AreEqual(2, output.Results.CalculationResults.Length); - Assert.AreEqual(2, output.Results.CalculationResults.Length); + DesignResult result = output.Results.CalculationResults[0]; + // SafetyFactor=1.972 (Zone Areas) + Assert.AreEqual(1.972, result.StabilityDesignResults.SafetyFactor, Tolerance); + Assert.AreEqual("DWP_10_2", result.LocationName); + Assert.AreEqual("DWP_10.sti", result.ProfileName); + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); - DesignResult result = output.Results.CalculationResults[0]; - // SafetyFactor=1.972 (Zone Areas) - Assert.AreEqual(1.972, result.StabilityDesignResults.SafetyFactor, Tolerance); - Assert.AreEqual("DWP_10_2", result.LocationName); - Assert.AreEqual("DWP_10.sti", result.ProfileName); - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + result = output.Results.CalculationResults[1]; + // SafetyFactor=2.034 (Forbidden Zone) + Assert.AreEqual(2.034, result.StabilityDesignResults.SafetyFactor, Tolerance); + Assert.AreEqual("DWP_10_6", result.LocationName); + Assert.AreEqual("DWP_10.sti", result.ProfileName); + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + } - result = output.Results.CalculationResults[1]; - // SafetyFactor=2.034 (Forbidden Zone) - Assert.AreEqual(2.034, result.StabilityDesignResults.SafetyFactor, Tolerance); - Assert.AreEqual("DWP_10_6", result.LocationName); - Assert.AreEqual("DWP_10.sti", result.ProfileName); - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + [Test, Category("Slow")] + public void TestRunMacroStabilityWithErrorUpliftVan() + { + // Expected results are determined by running .\data\DamEngineTestProjects\DeltaDijk_zonering_BI\DeltaDijk normal.damx + // with Dam Classic rev.1059 + // Select 5th and 6th location (6-4-3-A-1-C and 6-4-3-A-1-D) + // This project has 2 locations with each 2 profiles + // In one the combinations location-profile (1st location, 2nd profile) DGeoStability stops during the calculation. + // Then the kernel tries to read the safety factor, but fails because the dumpfile is not complete. + // In Release+Classic this returned a result Unexpected Error but the calculation continued with the next combination. + const string calcDir = "TestStabInwardsWithErrorUpliftVan"; + if (Directory.Exists(calcDir)) + { + Directory.Delete(calcDir, true); // delete previous results } - [Test, Category("Slow")] - public void TestRunMacroStabilityWithErrorUpliftVan() - { - // Expected results are determined by running .\data\DamEngineTestProjects\DeltaDijk_zonering_BI\DeltaDijk normal.damx - // with Dam Classic rev.1059 - // Select 5th and 6th location (6-4-3-A-1-C and 6-4-3-A-1-D) - // This project has 2 locations with each 2 profiles - // In one the combinations location-profile (1st location, 2nd profile) DGeoStability stops during the calculation. - // Then the kernel tries to read the safety factor, but fails because the dumpfile is not complete. - // In Release+Classic this returned a result Unexpected Error but the calculation continued with the next combination. - const string calcDir = "TestStabInwardsWithErrorUpliftVan"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + Directory.CreateDirectory(calcDir); - Directory.CreateDirectory(calcDir); + const string fileName = @"TestFiles\ErrorInDGeoStabilityCalculation.xml"; + string inputString = File.ReadAllText(fileName); + inputString = ChangeInputModel(inputString, InputStabilityModelType.UpliftVan); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - const string fileName = @"TestFiles\ErrorInDGeoStabilityCalculation.xml"; - string inputString = File.ReadAllText(fileName); - inputString = ChangeInputModel(inputString, InputStabilityModelType.UpliftVan); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); - string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.AreEqual(4, output.Results.CalculationResults.Length); + DesignResult result = output.Results.CalculationResults[0]; + Assert.AreEqual("6-4-3-A-1-C", result.LocationName); + Assert.AreEqual("6-4-3-A-1-C_1_s", result.ProfileName); + // Calculation Result + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // SafetyFactor=1.814 + Assert.AreEqual(1.814, result.StabilityDesignResults.SafetyFactor, Tolerance); - Assert.AreEqual(4, output.Results.CalculationResults.Length); - DesignResult result = output.Results.CalculationResults[0]; - Assert.AreEqual("6-4-3-A-1-C", result.LocationName); - Assert.AreEqual("6-4-3-A-1-C_1_s", result.ProfileName); - // Calculation Result - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); - // SafetyFactor=1.814 - Assert.AreEqual(1.814, result.StabilityDesignResults.SafetyFactor, Tolerance); + result = output.Results.CalculationResults[1]; + Assert.AreEqual("6-4-3-A-1-C", result.LocationName); + Assert.AreEqual("6-4-3-A-1-C_2_s", result.ProfileName); + // Calculation Result + Assert.AreEqual(CalculationResult.UnexpectedError, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // SafetyFactor not specified + Assert.IsFalse(result.StabilityDesignResults.SafetyFactorSpecified); - result = output.Results.CalculationResults[1]; - Assert.AreEqual("6-4-3-A-1-C", result.LocationName); - Assert.AreEqual("6-4-3-A-1-C_2_s", result.ProfileName); - // Calculation Result - Assert.AreEqual(CalculationResult.UnexpectedError, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); - // SafetyFactor not specified - Assert.IsFalse(result.StabilityDesignResults.SafetyFactorSpecified); + result = output.Results.CalculationResults[2]; + Assert.AreEqual("6-4-3-B-1-D", result.LocationName); + Assert.AreEqual("6-4-3-B-1-D_1_s", result.ProfileName); + // Calculation Result + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // SafetyFactor=2.099 + Assert.AreEqual(2.099, result.StabilityDesignResults.SafetyFactor, Tolerance); - result = output.Results.CalculationResults[2]; - Assert.AreEqual("6-4-3-B-1-D", result.LocationName); - Assert.AreEqual("6-4-3-B-1-D_1_s", result.ProfileName); - // Calculation Result - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); - // SafetyFactor=2.099 - Assert.AreEqual(2.099, result.StabilityDesignResults.SafetyFactor, Tolerance); + result = output.Results.CalculationResults[3]; + Assert.AreEqual("6-4-3-B-1-D", result.LocationName); + Assert.AreEqual("6-4-3-B-1-D_2_s", result.ProfileName); + // Calculation Result + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // SafetyFactor=2.300 + Assert.AreEqual(2.300, result.StabilityDesignResults.SafetyFactor, Tolerance); + } - result = output.Results.CalculationResults[3]; - Assert.AreEqual("6-4-3-B-1-D", result.LocationName); - Assert.AreEqual("6-4-3-B-1-D_2_s", result.ProfileName); - // Calculation Result - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); - // SafetyFactor=2.300 - Assert.AreEqual(2.300, result.StabilityDesignResults.SafetyFactor, Tolerance); + [Test, Category("Slow")] + [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] + public void TestRunMacroStabilityWithErrorBishopUpliftVan() + { + // Expected results are determined by running .\data\DamEngineTestProjects\DeltaDijk_zonering_BI\DeltaDijk normal.damx + // with Dam Classic rev.1059 + // Select 5th and 6th location (6-4-3-A-1-C and 6-4-3-A-1-D) + // This project has 2 locations with each 2 profiles + // In one the combinations location-profile (1st location, 2nd profile) DGeoStability stops during the calculation. + // Then the kernel tries to read the safety factor, but fails because the dumpfile is not complete. + // In Release+Classic this returned a result Unexpected Error but the calculation continued with the next combination. + const string calcDir = "TestStabInwardsWithErrorBishopUpliftVan"; + if (Directory.Exists(calcDir)) + { + Directory.Delete(calcDir, true); // delete previous results } - [Test, Category("Slow")] - [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] - public void TestRunMacroStabilityWithErrorBishopUpliftVan() - { - // Expected results are determined by running .\data\DamEngineTestProjects\DeltaDijk_zonering_BI\DeltaDijk normal.damx - // with Dam Classic rev.1059 - // Select 5th and 6th location (6-4-3-A-1-C and 6-4-3-A-1-D) - // This project has 2 locations with each 2 profiles - // In one the combinations location-profile (1st location, 2nd profile) DGeoStability stops during the calculation. - // Then the kernel tries to read the safety factor, but fails because the dumpfile is not complete. - // In Release+Classic this returned a result Unexpected Error but the calculation continued with the next combination. - const string calcDir = "TestStabInwardsWithErrorBishopUpliftVan"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + Directory.CreateDirectory(calcDir); - Directory.CreateDirectory(calcDir); + const string fileName = @"TestFiles\ErrorInDGeoStabilityCalculation.xml"; + string inputString = File.ReadAllText(fileName); + inputString = ChangeInputModel(inputString, InputStabilityModelType.BishopUpliftVan); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - const string fileName = @"TestFiles\ErrorInDGeoStabilityCalculation.xml"; - string inputString = File.ReadAllText(fileName); - inputString = ChangeInputModel(inputString, InputStabilityModelType.BishopUpliftVan); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); - string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.AreEqual(12, output.Results.CalculationResults.Length); - Assert.AreEqual(12, output.Results.CalculationResults.Length); + DesignResult result = output.Results.CalculationResults[3]; + Assert.AreEqual("6-4-3-A-1-C", result.LocationName); + Assert.AreEqual("6-4-3-A-1-C_2_s", result.ProfileName); + // Bishop + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // SafetyFactor=2.219 + Assert.AreEqual(2.219, result.StabilityDesignResults.SafetyFactor, Tolerance); + Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.Bishop, result.StabilityDesignResults.StabilityModelType); - DesignResult result = output.Results.CalculationResults[3]; - Assert.AreEqual("6-4-3-A-1-C", result.LocationName); - Assert.AreEqual("6-4-3-A-1-C_2_s", result.ProfileName); - // Bishop - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); - // SafetyFactor=2.219 - Assert.AreEqual(2.219, result.StabilityDesignResults.SafetyFactor, Tolerance); - Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.Bishop, result.StabilityDesignResults.StabilityModelType); + result = output.Results.CalculationResults[4]; + Assert.AreEqual("6-4-3-A-1-C", result.LocationName); + Assert.AreEqual("6-4-3-A-1-C_2_s", result.ProfileName); + // Uplift Van + Assert.AreEqual(CalculationResult.UnexpectedError, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // SafetyFactor not specified + Assert.IsFalse(result.StabilityDesignResults.SafetyFactorSpecified); + Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.UpliftVan, result.StabilityDesignResults.StabilityModelType); - result = output.Results.CalculationResults[4]; - Assert.AreEqual("6-4-3-A-1-C", result.LocationName); - Assert.AreEqual("6-4-3-A-1-C_2_s", result.ProfileName); - // Uplift Van - Assert.AreEqual(CalculationResult.UnexpectedError, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); - // SafetyFactor not specified - Assert.IsFalse(result.StabilityDesignResults.SafetyFactorSpecified); - Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.UpliftVan, result.StabilityDesignResults.StabilityModelType); + result = output.Results.CalculationResults[5]; + Assert.AreEqual("6-4-3-A-1-C", result.LocationName); + Assert.AreEqual("6-4-3-A-1-C_2_s", result.ProfileName); + // Bishop/Uplift Van + Assert.AreEqual(CalculationResult.UnexpectedError, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // SafetyFactor not specified + Assert.IsFalse(result.StabilityDesignResults.SafetyFactorSpecified); + Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan, result.StabilityDesignResults.StabilityModelType); + } - result = output.Results.CalculationResults[5]; - Assert.AreEqual("6-4-3-A-1-C", result.LocationName); - Assert.AreEqual("6-4-3-A-1-C_2_s", result.ProfileName); - // Bishop/Uplift Van - Assert.AreEqual(CalculationResult.UnexpectedError, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); - // SafetyFactor not specified - Assert.IsFalse(result.StabilityDesignResults.SafetyFactorSpecified); - Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan, result.StabilityDesignResults.StabilityModelType); + [Test, Category("Slow")] + public void TestRunFailedExpectCalculationMessageInOptimizedSlopeAndShoulderAdaption() + { + // Inputfile was created with .\data\DamEngineTestProjects\Invoer2\DAM Tutorial Design\DAM Tutorial Design.damx + // Select dwp 13 + // Expected: RunFailed + const string calcDir = "TestRunFailedExpectCalculationMessageInOptimizedSlopeAndShoulderAdaption"; + if (Directory.Exists(calcDir)) + { + Directory.Delete(calcDir, true); // delete previous results } - [Test, Category("Slow")] - public void TestRunFailedExpectCalculationMessageInOptimizedSlopeAndShoulderAdaption() - { - // Inputfile was created with .\data\DamEngineTestProjects\Invoer2\DAM Tutorial Design\DAM Tutorial Design.damx - // Select dwp 13 - // Expected: RunFailed - const string calcDir = "TestRunFailedExpectCalculationMessageInOptimizedSlopeAndShoulderAdaption"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + Directory.CreateDirectory(calcDir); - Directory.CreateDirectory(calcDir); + const string fileName = @"TestFiles\MacroStabilityRunFailedExpectCalculationMessage.xml"; + string inputString = File.ReadAllText(fileName); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - const string fileName = @"TestFiles\MacroStabilityRunFailedExpectCalculationMessage.xml"; - string inputString = File.ReadAllText(fileName); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); - string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.IsNull(output.Results.CalculationResults); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - Assert.IsNull(output.Results.CalculationResults); + Assert.AreEqual("Location 'DWP_13', subsoil scenario 'DWP_13.sti', design scenario '1': " + + "The preparation for this calculation failed.", + output.Results.CalculationMessages[0].Message1); + } - Assert.AreEqual("Location 'DWP_13', subsoil scenario 'DWP_13.sti', design scenario '1': " + - "The preparation for this calculation failed.", - output.Results.CalculationMessages[0].Message1); + [Test, Category("Slow")] + public void TestRunSlopeAdaptionBeforeShoulderAdaptionSucceeds() + { + // Inputfile was created with .\data\Dam\Benchmarks\Validatie SlopeAdaption\SlopeAdaption.damx + // Expected: a valid calculation. + const string calcDir = "TestRunFailedExpectCalculationMessageInSlopeAdaptionBeforeShoulderAdaption"; + if (Directory.Exists(calcDir)) + { + Directory.Delete(calcDir, true); // delete previous results } - [Test, Category("Slow")] - public void TestRunSlopeAdaptionBeforeShoulderAdaptionSucceeds() - { - // Inputfile was created with .\data\Dam\Benchmarks\Validatie SlopeAdaption\SlopeAdaption.damx - // Expected: a valid calculation. - const string calcDir = "TestRunFailedExpectCalculationMessageInSlopeAdaptionBeforeShoulderAdaption"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + Directory.CreateDirectory(calcDir); - Directory.CreateDirectory(calcDir); + const string fileName = @"TestFiles\ValidatieSlopeAdaption.xml"; + string inputString = File.ReadAllText(fileName); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\SlopeAdaption0.soilmaterials.mdb"); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - const string fileName = @"TestFiles\ValidatieSlopeAdaption.xml"; - string inputString = File.ReadAllText(fileName); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\SlopeAdaption0.soilmaterials.mdb"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); - string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.IsNotNull(output.Results.CalculationResults); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - Assert.IsNotNull(output.Results.CalculationResults); + Assert.AreEqual(1.724, output.Results.CalculationResults.First().StabilityDesignResults.SafetyFactor, Tolerance); + } - Assert.AreEqual(1.724, output.Results.CalculationResults.First().StabilityDesignResults.SafetyFactor, Tolerance); - } + [Test, Category("Slow")] + [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] + // Expected results are determined by running .\DamUI\trunk\data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx + // with Dam Classic rev.1059 + // Select 1st location (DWP_1) + // Set designscenario Safetyfactor Inwards to 1.4 + // Design strategy: OptimizedSlopeAndShoulderAdaption + // Set NewMinDistanceDikeToeStartDitch = 3.0, UseNewMinDistanceDikeToeStartDitch = true (to force value to be written to XML) + // + // 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.4847, 39.243, 73.587, 50.285, 3.465, 7, "")] + [TestCase("TestStabInwardsUpliftVanDesignOptimized", "UpliftVan", "OptimizedSlopeAndShoulderAdaption", CalculationResult.RunFailed, 1.214, 39.514, 66.926, 36.150, 0.0, 4, "The new shoulder height with topslope exceeds the allowed maximum height.")] + public void CanPerformStabilityInwardsDesignTutorialDesignOptimizedSlopeAndShoulderAdaption_OneLocation( + string calcDir, string stabilityModel, string designStrategy, + CalculationResult calculationResult, double expectedSafetyFactor, + double expectedZone1EntryPointX, double expectedZone1ExitPointX, + double expectedDikeLength, double expectedShoulderHeight, + int expectedNumberOfIterations, string expectedResultMessage) + { + const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile1LocationWithAdaption.xml"; + string inputString = File.ReadAllText(fileName); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "StabilityModelType", stabilityModel); + inputString = XmlAdapter.ChangeValueInXml(inputString, "StabilityDesignMethod", designStrategy); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - [Test, Category("Slow")] - [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] - // Expected results are determined by running .\DamUI\trunk\data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx - // with Dam Classic rev.1059 - // Select 1st location (DWP_1) - // Set designscenario Safetyfactor Inwards to 1.4 - // Design strategy: OptimizedSlopeAndShoulderAdaption - // Set NewMinDistanceDikeToeStartDitch = 3.0, UseNewMinDistanceDikeToeStartDitch = true (to force value to be written to XML) - // - // 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.4847, 39.243, 73.587, 50.285, 3.465, 7, "")] - [TestCase("TestStabInwardsUpliftVanDesignOptimized", "UpliftVan", "OptimizedSlopeAndShoulderAdaption", CalculationResult.RunFailed, 1.214, 39.514, 66.926, 36.150, 0.0, 4, "The new shoulder height with topslope exceeds the allowed maximum height.")] - public void CanPerformStabilityInwardsDesignTutorialDesignOptimizedSlopeAndShoulderAdaption_OneLocation( - string calcDir, string stabilityModel, string designStrategy, - CalculationResult calculationResult, double expectedSafetyFactor, - double expectedZone1EntryPointX, double expectedZone1ExitPointX, - double expectedDikeLength, double expectedShoulderHeight, - int expectedNumberOfIterations, string expectedResultMessage) - { - const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile1LocationWithAdaption.xml"; - string inputString = File.ReadAllText(fileName); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "StabilityModelType", stabilityModel); - inputString = XmlAdapter.ChangeValueInXml(inputString, "StabilityDesignMethod", designStrategy); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); - string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + DamProjectData actualDamProjectData = FillDamFromXmlOutput.CreateDamProjectData(null, output); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - DamProjectData actualDamProjectData = FillDamFromXmlOutput.CreateDamProjectData(null, output); + Assert.AreEqual(calculationResult, ConversionHelper.ConvertToCalculationResult( + output.Results.CalculationResults[0].CalculationResult)); - Assert.AreEqual(calculationResult, ConversionHelper.ConvertToCalculationResult( - output.Results.CalculationResults[0].CalculationResult)); - - DesignResultStabilityDesignResults stabilityDesignResults = output.Results.CalculationResults[0].StabilityDesignResults; - Assert.AreEqual(expectedSafetyFactor, stabilityDesignResults.SafetyFactor, Tolerance); - Assert.AreEqual(expectedNumberOfIterations, stabilityDesignResults.NumberOfIterations); - Assert.AreEqual(expectedResultMessage, stabilityDesignResults.ResultMessage); - SurfaceLine2 redesignedSurfaceLine = actualDamProjectData.DesignCalculations[0].StabilityDesignResults.RedesignedSurfaceLine; - if (redesignedSurfaceLine != null) + DesignResultStabilityDesignResults stabilityDesignResults = output.Results.CalculationResults[0].StabilityDesignResults; + Assert.AreEqual(expectedSafetyFactor, stabilityDesignResults.SafetyFactor, Tolerance); + Assert.AreEqual(expectedNumberOfIterations, stabilityDesignResults.NumberOfIterations); + Assert.AreEqual(expectedResultMessage, stabilityDesignResults.ResultMessage); + SurfaceLine2 redesignedSurfaceLine = actualDamProjectData.DesignCalculations[0].StabilityDesignResults.RedesignedSurfaceLine; + if (redesignedSurfaceLine != null) + { + Assert.That(redesignedSurfaceLine.GetDikeLength(), Is.EqualTo(expectedDikeLength).Within(Tolerance)); + GeometryPoint pointShoulderBaseInside = redesignedSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); + if (pointShoulderBaseInside != null) { - Assert.That(redesignedSurfaceLine.GetDikeLength(), Is.EqualTo(expectedDikeLength).Within(Tolerance)); - GeometryPoint pointShoulderBaseInside = redesignedSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); - if (pointShoulderBaseInside != null) - { - Assert.AreEqual(expectedShoulderHeight, pointShoulderBaseInside.Z, Tolerance); - } + Assert.AreEqual(expectedShoulderHeight, pointShoulderBaseInside.Z, Tolerance); } } + } - [Test] - [SetUICulture("nl-NL")] - public void TestGiveFeedBackWhenNoProfilesAreAvailable() + [Test] + [SetUICulture("nl-NL")] + public void TestGiveFeedBackWhenNoProfilesAreAvailable() + { + // Based on "dam/IssueRelatedData/MWDAM-1341/HHNK Leggerstudie\DAM Leggerstudie.defx" + // Import as Design -Primary dike: "DAM Leggerstudie.defx" + // Select first location and start calculation + // xml file is created with rev.2039 + const string calcDir = "TestGiveFeedBackWhenNoProfilesAreAvailable"; + if (Directory.Exists(calcDir)) { - // Based on "dam/IssueRelatedData/MWDAM-1341/HHNK Leggerstudie\DAM Leggerstudie.defx" - // Import as Design -Primary dike: "DAM Leggerstudie.defx" - // Select first location and start calculation - // xml file is created with rev.2039 - const string calcDir = "TestGiveFeedBackWhenNoProfilesAreAvailable"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + Directory.Delete(calcDir, true); // delete previous results + } - Directory.CreateDirectory(calcDir); + Directory.CreateDirectory(calcDir); - const string fileName = @"TestFiles\MacroStabilityNoProfilesInputFile.xml"; - string inputString = File.ReadAllText(fileName); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + const string fileName = @"TestFiles\MacroStabilityNoProfilesInputFile.xml"; + string inputString = File.ReadAllText(fileName); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); + string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - Assert.AreEqual(null, output.Results.CalculationResults); - Assert.AreEqual(2, output.Results.CalculationMessages.Length); - Assert.AreEqual(MessageMessageType.Warning, output.Results.CalculationMessages[0].MessageType); - Assert.AreEqual("Geen ondergrond profielen beschikbaar voor locatie '12-2_027'", output.Results.CalculationMessages[0].Message1); - } + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.AreEqual(null, output.Results.CalculationResults); + Assert.AreEqual(2, output.Results.CalculationMessages.Length); + Assert.AreEqual(MessageMessageType.Warning, output.Results.CalculationMessages[0].MessageType); + Assert.AreEqual("Geen ondergrond profielen beschikbaar voor locatie '12-2_027'", output.Results.CalculationMessages[0].Message1); + } - [Test] - public void TestDesignWithRiverLevelAboveDikeTopButBelowDthCanNotCalculate() - { - var analysisType = "AdaptGeometry"; - // Test just to see if calculation works in this case as it should do. - string outputString = GetOutputStringForProject(analysisType); + [Test] + public void TestDesignWithRiverLevelAboveDikeTopButBelowDthCanNotCalculate() + { + var analysisType = "AdaptGeometry"; + // Test just to see if calculation works in this case as it should do. + string outputString = GetOutputStringForProject(analysisType); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - Assert.IsNull(output.Results.CalculationResults, "No results available"); - // Note Bka: it already failed, but now for a different reason.Probably because DTH is not yet taken into account with testing/adjusting the data. - Assert.IsTrue(output.Results.CalculationMessages[0].Message1.Contains("Location 'DWP_1', subsoil scenario 'DWP_1.sti', design scenario '1': " + - "The calculation failed with error message 'Value cannot be null.")); - } + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.IsNull(output.Results.CalculationResults, "No results available"); + // Note Bka: it already failed, but now for a different reason.Probably because DTH is not yet taken into account with testing/adjusting the data. + Assert.IsTrue(output.Results.CalculationMessages[0].Message1.Contains("Location 'DWP_1', subsoil scenario 'DWP_1.sti', design scenario '1': " + + "The calculation failed with error message 'Value cannot be null.")); + } - [Test] - public void TestNoDesignWithRiverLevelAboveDikeTopButBelowDthCanNotCalculate() - { - var analysisType = "NoAdaption"; - // Test to see if calculation does NOT work in this case as it must fail with water level above dike top. - string outputString = GetOutputStringForProject(analysisType); + [Test] + public void TestNoDesignWithRiverLevelAboveDikeTopButBelowDthCanNotCalculate() + { + var analysisType = "NoAdaption"; + // Test to see if calculation does NOT work in this case as it must fail with water level above dike top. + string outputString = GetOutputStringForProject(analysisType); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - Assert.IsNull(output.Results.CalculationResults, "Should have results available"); - Assert.AreEqual(2, output.Results.CalculationMessages.Length, Tolerance); - } + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.IsNull(output.Results.CalculationResults, "Should have results available"); + Assert.AreEqual(2, output.Results.CalculationMessages.Length, Tolerance); + } - [Test, Category("Slow")] - public void TestRunMacroStabilityDeltaDijkBishopWith1DProducesStixFiles() + [Test, Category("Slow")] + public void TestRunMacroStabilityDeltaDijkBishopWith1DProducesStixFiles() + { + // Expected results are taken as is from the first run with the new kernel + // This tests use of 1D profiles + // Selected location (6-4-1-A-1-F) + // Analysis type "No adaption" + // Calculation options: Stability Inside - Bishop + const string calcDir = "TestStabInwardsBishopWithStixFiles"; + if (Directory.Exists(calcDir)) { - // Expected results are taken as is from the first run with the new kernel - // This tests use of 1D profiles - // Selected location (6-4-1-A-1-F) - // Analysis type "No adaption" - // Calculation options: Stability Inside - Bishop - const string calcDir = "TestStabInwardsBishopWithStixFiles"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + Directory.Delete(calcDir, true); // delete previous results + } - Directory.CreateDirectory(calcDir); + Directory.CreateDirectory(calcDir); - const string fileName = @"TestFiles\DeltaDijkBishopInwards.xml"; - string inputString = File.ReadAllText(fileName); - inputString = ChangeInputModel(inputString, InputStabilityModelType.Bishop); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); + const string fileName = @"TestFiles\DeltaDijkBishopInwards.xml"; + string inputString = File.ReadAllText(fileName); + inputString = ChangeInputModel(inputString, InputStabilityModelType.Bishop); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); + string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - // one location is calculated with 3 1D profiles - Assert.AreEqual(3, output.Results.CalculationResults.Length); - Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[0].LocationName); - Assert.AreEqual("6-4-1-A-1-F_1_s", output.Results.CalculationResults[0].ProfileName); - Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[1].LocationName); - Assert.AreEqual("6-4-1-A-1-F_2_s", output.Results.CalculationResults[1].ProfileName); - Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[2].LocationName); - Assert.AreEqual("6-4-1-A-1-F_3_s", output.Results.CalculationResults[2].ProfileName); + // one location is calculated with 3 1D profiles + Assert.AreEqual(3, output.Results.CalculationResults.Length); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[0].LocationName); + Assert.AreEqual("6-4-1-A-1-F_1_s", output.Results.CalculationResults[0].ProfileName); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[1].LocationName); + Assert.AreEqual("6-4-1-A-1-F_2_s", output.Results.CalculationResults[1].ProfileName); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[2].LocationName); + Assert.AreEqual("6-4-1-A-1-F_3_s", output.Results.CalculationResults[2].ProfileName); - DesignResult result = output.Results.CalculationResults[0]; - // SafetyFactor=1.682 - Assert.AreEqual(1.682, result.StabilityDesignResults.SafetyFactor, Tolerance); + DesignResult result = output.Results.CalculationResults[0]; + // SafetyFactor=1.682 + Assert.AreEqual(1.682, result.StabilityDesignResults.SafetyFactor, Tolerance); - // skip testing some of the results like uplift etc. + // skip testing some of the results like uplift etc. - // Calculation Result - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // Calculation Result + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); - // test safety factor for other profiles - result = output.Results.CalculationResults[1]; - // SafetyFactor=1.644 - Assert.AreEqual(1.644, result.StabilityDesignResults.SafetyFactor, Tolerance); - result = output.Results.CalculationResults[2]; - // SafetyFactor=1.682 - Assert.AreEqual(1.682, result.StabilityDesignResults.SafetyFactor, Tolerance); + // test safety factor for other profiles + result = output.Results.CalculationResults[1]; + // SafetyFactor=1.644 + Assert.AreEqual(1.644, result.StabilityDesignResults.SafetyFactor, Tolerance); + result = output.Results.CalculationResults[2]; + // SafetyFactor=1.682 + Assert.AreEqual(1.682, result.StabilityDesignResults.SafetyFactor, Tolerance); - // Stix file - var fileList = new List - { + // Stix file + var fileList = new List + { #if DEBUG - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_3_s)_input.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_3_s)_input.stix", #endif - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix", - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_3_s)_result.stix" - }; - foreach (string file in fileList.Select(file => Path.Combine(Path.GetFullPath(calcDir), file))) - { - Assert.IsTrue(File.Exists(file), file + " does not exist"); - } + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_3_s)_result.stix" + }; + foreach (string file in fileList.Select(file => Path.Combine(Path.GetFullPath(calcDir), file))) + { + Assert.IsTrue(File.Exists(file), file + " does not exist"); } + } - [Test, Category("Slow")] - public void TestRunMacroStabilityDeltaDijkUpliftVanWith1DProducesStixFiles() + [Test, Category("Slow")] + public void TestRunMacroStabilityDeltaDijkUpliftVanWith1DProducesStixFiles() + { + // Expected results are taken as is from the first run with the new kernel + // Selected location (6-4-1-A-1-F) + // Analysis type "No adaption" + // Calculation options: Stability Inside - UpliftVan + // This tests use of 1D profiles + const string calcDir = "TestStabInwardsUpliftVanWithStixFiles"; + if (Directory.Exists(calcDir)) { - // Expected results are taken as is from the first run with the new kernel - // Selected location (6-4-1-A-1-F) - // Analysis type "No adaption" - // Calculation options: Stability Inside - UpliftVan - // This tests use of 1D profiles - const string calcDir = "TestStabInwardsUpliftVanWithStixFiles"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + Directory.Delete(calcDir, true); // delete previous results + } - Directory.CreateDirectory(calcDir); + Directory.CreateDirectory(calcDir); - // Read as Bishop, then change to UpliftVan - const string fileName = @"TestFiles\DeltaDijkBishopInwards.xml"; - string inputString = File.ReadAllText(fileName); - inputString = ChangeInputModel(inputString, InputStabilityModelType.UpliftVan); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + // Read as Bishop, then change to UpliftVan + const string fileName = @"TestFiles\DeltaDijkBishopInwards.xml"; + string inputString = File.ReadAllText(fileName); + inputString = ChangeInputModel(inputString, InputStabilityModelType.UpliftVan); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); + string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - // one location is calculated with 3 1D profiles - // However, profile 6-4-1-A-1-F_3_s has no UpliftVan occuring and thus has no result - Assert.AreEqual(2, output.Results.CalculationResults.Length); - Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[0].LocationName); - Assert.AreEqual("6-4-1-A-1-F_1_s", output.Results.CalculationResults[0].ProfileName); - Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[1].LocationName); - Assert.AreEqual("6-4-1-A-1-F_2_s", output.Results.CalculationResults[1].ProfileName); + // one location is calculated with 3 1D profiles + // However, profile 6-4-1-A-1-F_3_s has no UpliftVan occuring and thus has no result + Assert.AreEqual(2, output.Results.CalculationResults.Length); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[0].LocationName); + Assert.AreEqual("6-4-1-A-1-F_1_s", output.Results.CalculationResults[0].ProfileName); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[1].LocationName); + Assert.AreEqual("6-4-1-A-1-F_2_s", output.Results.CalculationResults[1].ProfileName); - DesignResult result = output.Results.CalculationResults[0]; - // SafetyFactor=1.638 DSTAB 1.518 (1.079) - Assert.AreEqual(1.638, result.StabilityDesignResults.SafetyFactor, Tolerance); + DesignResult result = output.Results.CalculationResults[0]; + // SafetyFactor=1.638 DSTAB 1.518 (1.079) + Assert.AreEqual(1.638, result.StabilityDesignResults.SafetyFactor, Tolerance); - // skip testing some of the results like uplift etc. + // skip testing some of the results like uplift etc. - // Calculation Result - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // Calculation Result + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); - // test safety factor for other profiles - result = output.Results.CalculationResults[1]; - // SafetyFactor=1.551 DSTAB 1.414. 1.097 - Assert.AreEqual(1.551, result.StabilityDesignResults.SafetyFactor, Tolerance); - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // test safety factor for other profiles + result = output.Results.CalculationResults[1]; + // SafetyFactor=1.551 DSTAB 1.414. 1.097 + Assert.AreEqual(1.551, result.StabilityDesignResults.SafetyFactor, Tolerance); + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); - var fileList = new List - { + var fileList = new List + { #if DEBUG - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", + "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", + "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", #endif - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix" - }; - foreach (string file in fileList.Select(file => Path.Combine(Path.GetFullPath(calcDir), file))) - { - Assert.IsTrue(File.Exists(file), file + " does not exist"); - } + "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", + "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix" + }; + foreach (string file in fileList.Select(file => Path.Combine(Path.GetFullPath(calcDir), file))) + { + Assert.IsTrue(File.Exists(file), file + " does not exist"); } + } - [Test, Category("Slow")] - public void TestRunMacroStabilityDeltaDijkBishopUpliftVanWith1DWithUpliftProducesStixFiles() + [Test, Category("Slow")] + public void TestRunMacroStabilityDeltaDijkBishopUpliftVanWith1DWithUpliftProducesStixFiles() + { + // Expected results are taken as is from the first run with the new kernel + // This tests use of 1D profiles + // Selected location (6-4-1-A-1-F) + // Analysis type "No adaption" + // Calculation options: Stability Inside - Bishop + const string calcDir = "TestStabInwardsBishopUpliftVanWithUpliftWithStixFiles"; + if (Directory.Exists(calcDir)) { - // Expected results are taken as is from the first run with the new kernel - // This tests use of 1D profiles - // Selected location (6-4-1-A-1-F) - // Analysis type "No adaption" - // Calculation options: Stability Inside - Bishop - const string calcDir = "TestStabInwardsBishopUpliftVanWithUpliftWithStixFiles"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + Directory.Delete(calcDir, true); // delete previous results + } - Directory.CreateDirectory(calcDir); + Directory.CreateDirectory(calcDir); - const string fileName = @"TestFiles\DeltaDijkBishopInwards.xml"; - string inputString = File.ReadAllText(fileName); - inputString = ChangeInputModel(inputString, InputStabilityModelType.BishopUpliftVan); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); + const string fileName = @"TestFiles\DeltaDijkBishopInwards.xml"; + string inputString = File.ReadAllText(fileName); + inputString = ChangeInputModel(inputString, InputStabilityModelType.BishopUpliftVan); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); + string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - // one location is calculated with 3 1D profiles - Assert.AreEqual(3, output.Results.CalculationResults.Length); - Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[0].LocationName); - Assert.AreEqual("6-4-1-A-1-F_1_s", output.Results.CalculationResults[0].ProfileName); - Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[1].LocationName); - Assert.AreEqual("6-4-1-A-1-F_2_s", output.Results.CalculationResults[1].ProfileName); - Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[2].LocationName); - Assert.AreEqual("6-4-1-A-1-F_3_s", output.Results.CalculationResults[2].ProfileName); + // one location is calculated with 3 1D profiles + Assert.AreEqual(3, output.Results.CalculationResults.Length); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[0].LocationName); + Assert.AreEqual("6-4-1-A-1-F_1_s", output.Results.CalculationResults[0].ProfileName); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[1].LocationName); + Assert.AreEqual("6-4-1-A-1-F_2_s", output.Results.CalculationResults[1].ProfileName); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[2].LocationName); + Assert.AreEqual("6-4-1-A-1-F_3_s", output.Results.CalculationResults[2].ProfileName); - DesignResult result = output.Results.CalculationResults[0]; - // SafetyFactor=1.638 - Assert.AreEqual(1.638, result.StabilityDesignResults.SafetyFactor, Tolerance); + DesignResult result = output.Results.CalculationResults[0]; + // SafetyFactor=1.638 + Assert.AreEqual(1.638, result.StabilityDesignResults.SafetyFactor, Tolerance); - // skip testing some of the results like uplift etc. + // skip testing some of the results like uplift etc. - // Calculation Result - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // Calculation Result + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); - // test safety factor for other profiles - result = output.Results.CalculationResults[1]; - // SafetyFactor=1.551 - Assert.AreEqual(1.551, result.StabilityDesignResults.SafetyFactor, Tolerance); + // test safety factor for other profiles + result = output.Results.CalculationResults[1]; + // SafetyFactor=1.551 + Assert.AreEqual(1.551, result.StabilityDesignResults.SafetyFactor, Tolerance); - // Stix file - var fileList = new List - { + // Stix file + var fileList = new List + { #if DEBUG - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", + "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", + "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", #endif - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix", - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix" - }; - foreach (string file in fileList.Select(file => Path.Combine(Path.GetFullPath(calcDir), file))) - { - Assert.IsTrue(File.Exists(file), file + " does not exist"); - } + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix", + "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", + "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix" + }; + foreach (string file in fileList.Select(file => Path.Combine(Path.GetFullPath(calcDir), file))) + { + Assert.IsTrue(File.Exists(file), file + " does not exist"); } + } - [Test, Category("Slow")] - public void TestRunMacroStabilityDeltaDijkBishopUpliftVanWith1DWithoutUpliftProducesStixFiles() + [Test, Category("Slow")] + public void TestRunMacroStabilityDeltaDijkBishopUpliftVanWith1DWithoutUpliftProducesStixFiles() + { + // Expected results are taken as is from the first run with the new kernel + // This tests use of 1D profiles + // Selected location (6-4-1-A-1-F) + // Analysis type "No adaption" + // Calculation options: Stability Inside - Bishop + const string calcDir = "TestStabInwardsBishopUpliftVanWithoutUpliftWithStixFiles"; + if (Directory.Exists(calcDir)) { - // Expected results are taken as is from the first run with the new kernel - // This tests use of 1D profiles - // Selected location (6-4-1-A-1-F) - // Analysis type "No adaption" - // Calculation options: Stability Inside - Bishop - const string calcDir = "TestStabInwardsBishopUpliftVanWithoutUpliftWithStixFiles"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + Directory.Delete(calcDir, true); // delete previous results + } - Directory.CreateDirectory(calcDir); + Directory.CreateDirectory(calcDir); - const string fileName = @"TestFiles\DeltaDijkBishopInwards.xml"; - string inputString = File.ReadAllText(fileName); - inputString = ChangeInputModel(inputString, InputStabilityModelType.BishopUpliftVan); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "UpliftCriterionStability", @"1.0"); + const string fileName = @"TestFiles\DeltaDijkBishopInwards.xml"; + string inputString = File.ReadAllText(fileName); + inputString = ChangeInputModel(inputString, InputStabilityModelType.BishopUpliftVan); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "UpliftCriterionStability", @"1.0"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); + string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - // one location is calculated with 3 1D profiles - Assert.AreEqual(3, output.Results.CalculationResults.Length); - Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[0].LocationName); - Assert.AreEqual("6-4-1-A-1-F_1_s", output.Results.CalculationResults[0].ProfileName); - Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[1].LocationName); - Assert.AreEqual("6-4-1-A-1-F_2_s", output.Results.CalculationResults[1].ProfileName); + // one location is calculated with 3 1D profiles + Assert.AreEqual(3, output.Results.CalculationResults.Length); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[0].LocationName); + Assert.AreEqual("6-4-1-A-1-F_1_s", output.Results.CalculationResults[0].ProfileName); + Assert.AreEqual("6-4-1-A-1-F", output.Results.CalculationResults[1].LocationName); + Assert.AreEqual("6-4-1-A-1-F_2_s", output.Results.CalculationResults[1].ProfileName); - DesignResult result = output.Results.CalculationResults[0]; - // SafetyFactor=1.682 - Assert.AreEqual(1.682, result.StabilityDesignResults.SafetyFactor, Tolerance); + DesignResult result = output.Results.CalculationResults[0]; + // SafetyFactor=1.682 + Assert.AreEqual(1.682, result.StabilityDesignResults.SafetyFactor, Tolerance); - // skip testing some of the results like uplift etc. + // skip testing some of the results like uplift etc. - // Calculation Result - Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // Calculation Result + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); - // test safety factor for other profiles - result = output.Results.CalculationResults[1]; - // SafetyFactor=1.644 - Assert.AreEqual(1.644, result.StabilityDesignResults.SafetyFactor, Tolerance); + // test safety factor for other profiles + result = output.Results.CalculationResults[1]; + // SafetyFactor=1.644 + Assert.AreEqual(1.644, result.StabilityDesignResults.SafetyFactor, Tolerance); - // Stix file - var existingFilesList = new List - { + // Stix file + var existingFilesList = new List + { #if DEBUG - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_3_s)_input.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_3_s)_input.stix", #endif - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix", - "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_3_s)_result.stix" - }; - foreach (string file in existingFilesList.Select(file => Path.Combine(Path.GetFullPath(calcDir), file))) - { - Assert.IsTrue(File.Exists(file), file + " does not exist"); - } + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix", + "Stability\\Bishop\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_3_s)_result.stix" + }; + foreach (string file in existingFilesList.Select(file => Path.Combine(Path.GetFullPath(calcDir), file))) + { + Assert.IsTrue(File.Exists(file), file + " does not exist"); + } - var noneExistingFilesList = new List - { + var noneExistingFilesList = new List + { #if DEBUG - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", + "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_input.stix", + "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_input.stix", #endif - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", - "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix" - }; - foreach (string file in noneExistingFilesList.Select(file => Path.Combine(Path.GetFullPath(calcDir), file))) - { - Assert.IsFalse(File.Exists(file), file + " does exist"); - } + "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_1_s)_result.stix", + "Stability\\UpliftVan\\Loc(6-4-1-A-1-F)_Sce(1)_Pro(6-4-1-A-1-F_2_s)_result.stix" + }; + foreach (string file in noneExistingFilesList.Select(file => Path.Combine(Path.GetFullPath(calcDir), file))) + { + Assert.IsFalse(File.Exists(file), file + " does exist"); } + } - private void RemoveUsedDirectoryAfterTests(string directory) + private void RemoveUsedDirectoryAfterTests(string directory) + { + if (Directory.Exists(directory)) { - if (Directory.Exists(directory)) - { - Directory.Delete(directory, true); - } + Directory.Delete(directory, true); } + } - private static string GetOutputStringForProject(string analysisType) + private static string GetOutputStringForProject(string analysisType) + { + const string calcDir = "TestStabInwardsBishop"; + if (Directory.Exists(calcDir)) { - const string calcDir = "TestStabInwardsBishop"; - if (Directory.Exists(calcDir)) - { - Directory.Delete(calcDir, true); // delete previous results - } + Directory.Delete(calcDir, true); // delete previous results + } - Directory.CreateDirectory(calcDir); + Directory.CreateDirectory(calcDir); - const string fileName = @"TestFiles\DesignInputFileWithRiverLevelAboveDikeTopButBelowDTH.xml"; - string inputString = File.ReadAllText(fileName); - inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used - inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", - @"TestFiles\DAM Tutorial Design.geometries2D.0\"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", - @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); - inputString = XmlAdapter.ChangeValueInXml(inputString, "SegmentFailureMechanismType", - ConversionHelper.InputSegmentFailureMechanismStability.ToString()); + const string fileName = @"TestFiles\DesignInputFileWithRiverLevelAboveDikeTopButBelowDTH.xml"; + string inputString = File.ReadAllText(fileName); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", + @"TestFiles\DAM Tutorial Design.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", + @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SegmentFailureMechanismType", + ConversionHelper.InputSegmentFailureMechanismStability.ToString()); - inputString = XmlAdapter.ChangeValueInXml(inputString, "AnalysisType", analysisType); + inputString = XmlAdapter.ChangeValueInXml(inputString, "AnalysisType", analysisType); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); + var engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); - return outputString; - } + string outputString = engineInterface.Run(); + return outputString; + } - private string ChangeInputModel(string input, InputStabilityModelType modelType) + private string ChangeInputModel(string input, InputStabilityModelType modelType) + { + var pattern = "StabilityModelType=\"[a-zA-Z]+\""; + string replacement = pattern; + switch (modelType) { - var pattern = "StabilityModelType=\"[a-zA-Z]+\""; - string replacement = pattern; - switch (modelType) - { - case InputStabilityModelType.Bishop: - replacement = "StabilityModelType=\"Bishop\""; - break; - case InputStabilityModelType.UpliftVan: - replacement = "StabilityModelType=\"UpliftVan\""; - break; - case InputStabilityModelType.BishopUpliftVan: - replacement = "StabilityModelType=\"BishopUpliftVan\""; - break; - } - - string result = Regex.Replace(input, pattern, replacement); - return result; + case InputStabilityModelType.Bishop: + replacement = "StabilityModelType=\"Bishop\""; + break; + case InputStabilityModelType.UpliftVan: + replacement = "StabilityModelType=\"UpliftVan\""; + break; + case InputStabilityModelType.BishopUpliftVan: + replacement = "StabilityModelType=\"BishopUpliftVan\""; + break; } + + string result = Regex.Replace(input, pattern, replacement); + return result; } } \ No newline at end of file