Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingSellmeijerVnkTests.cs =================================================================== diff -u -r1389 -r1403 --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingSellmeijerVnkTests.cs (.../PipingSellmeijerVnkTests.cs) (revision 1389) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingSellmeijerVnkTests.cs (.../PipingSellmeijerVnkTests.cs) (revision 1403) @@ -152,7 +152,7 @@ Assert.AreEqual(-1.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.SellmeijerVnkFactor, tolerance); Assert.AreEqual("The new shoulder length is too large to fit in the current surface line.", output.Results.CalculationResults.DesignResults[0].PipingDesignResults.ResultMessage); - Assert.AreEqual("Location Profiel 1, subsoil scenario 'soilprofile_01', design scenario '1': " + + Assert.AreEqual("Location 'Profiel 1', subsoil scenario 'soilprofile_01', design scenario '1': " + "The calculation failed with error message " + "'The design was not successful. " + "The new shoulder length is too large to fit in the current surface line.'", Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityInwardsTests.cs =================================================================== diff -u -r1259 -r1403 --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 1259) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 1403) @@ -722,6 +722,50 @@ } [Test, Category("Slow")] + public void TestRunFailedExpectCalculationMessage() + { + // Inputfile was created with .\data\DamEngineTestProjects\Invoer2\DAM Tutorial Design\DAM Tutorial Design.damx + // Select dwp 13 + // Expected: RunFailed + const string calcDir = "TestRunFailedExpectCalculationMessage"; + if (Directory.Exists(calcDir)) + { + Directory.Delete(calcDir, true); // delete previous results + } + + 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"); + EngineInterface engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); + + string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); + + var output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.AreEqual(1, output.Results.CalculationResults.DesignResults.Length); + + var result = output.Results.CalculationResults.DesignResults[0]; + Assert.AreEqual(CalculationResult.RunFailed, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + + Assert.AreEqual("The new shoulder height with topslope exceeds the allowed maximum height.", + output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.ResultMessage); + Assert.AreEqual("Location 'DWP_13', subsoil scenario 'DWP_13.sti', design scenario '1': " + + "The calculation failed with error message " + + "'The design was not successful. " + + "The new shoulder height with topslope exceeds the allowed maximum height.'", + output.Results.CalculationMessages[0].Message1); + } + + + + + [Test, Category("Slow")] // 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) Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs =================================================================== diff -u -r1375 -r1403 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs (.../DesignCalculatorCombinedSlopeAndShoulderAdaption.cs) (revision 1375) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs (.../DesignCalculatorCombinedSlopeAndShoulderAdaption.cs) (revision 1403) @@ -24,6 +24,7 @@ using System.Linq; using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; +using Deltares.DamEngine.Calculators.Properties; using Deltares.DamEngine.Data.Design; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.Results; @@ -154,27 +155,25 @@ designScenario.CalculationResult = CalculationResult.Succeeded; designScenario.SetResultMessage(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName, "Succes"); kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, designScenario, resultMessage, out designResults); + designCalculations.AddRange(designResults); } catch (Exception exception) { - string errorMessage = "FAIL: " + exception.Message; + string errorMessage = exception.Message; Exception innerException = exception.InnerException; while (innerException != null) { errorMessage = errorMessage + ";" + innerException.Message; innerException = innerException.InnerException; } designScenario.SetResultMessage(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName, errorMessage); - // Add message to log too for output tab. - errorMessage = location.Name + ", scenario " + designScenario.LocationScenarioID + ", " + subSoilScenario.ToString() + " " + errorMessage; - // stabilityCalculator.ErrorMessages.Add(new LogMessage(LogMessageType.Error, this, errorMessage)); designScenario.CalculationResult = CalculationResult.RunFailed; // Redesign not succesful, so no redesigned surfaceline will be returned designScenario.SetRedesignedSurfaceLine(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName, null); kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, designScenario, errorMessage, out designResults); + designCalculations.AddRange(designResults); + throw new DesignCalculatorException(Resources.DesignUnsuccessful + " " + errorMessage); } - designCalculations.AddRange(designResults); - } } } Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/MacroStabilityRunFailedExpectCalculationMessage.xml =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/MacroStabilityRunFailedExpectCalculationMessage.xml (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/MacroStabilityRunFailedExpectCalculationMessage.xml (revision 1403) @@ -0,0 +1,323 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs =================================================================== diff -u -r1363 -r1403 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1363) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1403) @@ -218,7 +218,7 @@ } /// - /// Looks up a localized string similar to Location {0}, subsoil scenario '{1}', design scenario '{2}': The calculation failed with error message '{3}'. + /// Looks up a localized string similar to Location '{0}', subsoil scenario '{1}', design scenario '{2}': The calculation failed with error message '{3}'. /// internal static string DesignCalculatorGeneralException { get { @@ -236,7 +236,7 @@ } /// - /// Looks up a localized string similar to Location {0}, subsoil scenario '{1}', design scenario '{2}': The preparation for this calculation failed.. + /// Looks up a localized string similar to Location '{0}', subsoil scenario '{1}', design scenario '{2}': The preparation for this calculation failed.. /// internal static string DesignCalculatorPrepareError { get { Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx =================================================================== diff -u -r1363 -r1403 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 1363) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 1403) @@ -154,7 +154,7 @@ Required safety factor must be specified - Location {0}, subsoil scenario '{1}', design scenario '{2}': The preparation for this calculation failed. + Location '{0}', subsoil scenario '{1}', design scenario '{2}': The preparation for this calculation failed. The use of Zone Areas is not allowed for stability outside. @@ -265,6 +265,6 @@ Required safety factor must be specified. - Location {0}, subsoil scenario '{1}', design scenario '{2}': The calculation failed with error message '{3}' + Location '{0}', subsoil scenario '{1}', design scenario '{2}': The calculation failed with error message '{3}' \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj =================================================================== diff -u -r1362 -r1403 --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj (.../Deltares.DamEngine.Interface.Tests.csproj) (revision 1362) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj (.../Deltares.DamEngine.Interface.Tests.csproj) (revision 1403) @@ -129,6 +129,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs =================================================================== diff -u -r1363 -r1403 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs (.../DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs) (revision 1363) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs (.../DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs) (revision 1403) @@ -24,6 +24,7 @@ using System.Linq; using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; +using Deltares.DamEngine.Calculators.Properties; using Deltares.DamEngine.Data.Design; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.Results; @@ -163,11 +164,11 @@ designScenario.SetResultMessage(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName, "Succes"); designScenario.CalculationResult = CalculationResult.Succeeded; kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, designScenario, resultMessage, out designResults); - + designCalculations.AddRange(designResults); } catch (Exception exception) { - string errorMessage = "FAIL: " + exception.Message; + string errorMessage = exception.Message; Exception innerException = exception.InnerException; while (innerException != null) { @@ -179,8 +180,9 @@ // Redesign not succesful, so no redesigned surfaceline will be returned designScenario.SetRedesignedSurfaceLine(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName, null); kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, designScenario, errorMessage, out designResults); + designCalculations.AddRange(designResults); + throw new DesignCalculatorException(Resources.DesignUnsuccessful + " " + errorMessage); } - designCalculations.AddRange(designResults); } } }