Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCoreMacroStabilityTests.cs =================================================================== diff -u -r4462 -r4474 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCoreMacroStabilityTests.cs (.../MultiCoreMacroStabilityTests.cs) (revision 4462) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCoreMacroStabilityTests.cs (.../MultiCoreMacroStabilityTests.cs) (revision 4474) @@ -39,9 +39,8 @@ { private const string mapTestFiles = @"TestFiles\"; const string testWorkingFolder = @"MultiCore\"; - private const double tol2Digits = 0.005; - private const double tolerance = 0.0005; - + private const double tolerance3Decimals = 0.00051; + [OneTimeSetUp] public void Setup() { @@ -54,7 +53,7 @@ RemoveTestWorkingDirectory(); // to be sure no test directory exist after the tests } - [Test, Category("MultiCore")] + [Test, Category(Categories.MultiCore)] [TestCase("OperationalBishopGrid1Core.xml")] [TestCase("OperationalBishopGrid2Cores.xml")] [TestCase("OperationalBishopGrid4Cores.xml")] @@ -66,43 +65,33 @@ Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; string inputString = File.ReadAllText(fullInputFilename); var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - engineInterface.DamProjectData.ProjectPath = @"MultiCore\"; - string result = engineInterface.Validate(); - Assert.IsNull(result, "Validation must succeed but does not, see output xml in debugger"); - string outputString = engineInterface.Run(); - File.WriteAllText("Output.xml", outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(engineInterface, true, "Output.xml"); + int errorCount = GeneralHelper.DetermineNumberOfCalculationErrors(engineInterface.DamProjectData.CalculationMessages); Assert.AreEqual(0, errorCount, "There should be no errors during the calculation."); Assert.AreEqual(output.Results.CalculationMessages.Length, engineInterface.DamProjectData.CalculationMessages.Count); - if (engineInterface.DamProjectData.DamProjectType == DamProjectType.Design) + Assert.IsTrue(engineInterface.DamProjectData.DamProjectType == DamProjectType.Operational); + Assert.AreEqual(8, output.Results.OperationalOutputTimeSeries.Length); + int numberOfResults = 0; + int numberOfRealResults = 0; + foreach (TimeSerie resultSerie in output.Results.OperationalOutputTimeSeries) { - Assert.AreNotEqual(null, output.Results.CalculationResults); - } - else - { - Assert.AreEqual(8, output.Results.OperationalOutputTimeSeries.Length); - int numberOfResults = 0; - int numberOfRealResults = 0; - foreach (TimeSerie resultSerie in output.Results.OperationalOutputTimeSeries) + numberOfResults += resultSerie.Entries.TimeSerieEntry.Length; + foreach (TimeSerieEntriesTimeSerieEntry timeSerieEntriesTimeSerieEntry in resultSerie.Entries.TimeSerieEntry) { - numberOfResults += resultSerie.Entries.TimeSerieEntry.Length; - foreach (TimeSerieEntriesTimeSerieEntry timeSerieEntriesTimeSerieEntry in resultSerie.Entries.TimeSerieEntry) + if (!Double.IsNaN(timeSerieEntriesTimeSerieEntry.Value) && + timeSerieEntriesTimeSerieEntry.Value is > 0 and < 100000) { - if (!Double.IsNaN(timeSerieEntriesTimeSerieEntry.Value) && - timeSerieEntriesTimeSerieEntry.Value is > 0 and < 100000) - { - numberOfRealResults++; - } + numberOfRealResults++; } } - Assert.AreEqual(16, numberOfResults); - Assert.AreEqual(16, numberOfRealResults); } + Assert.AreEqual(16, numberOfResults); + Assert.AreEqual(16, numberOfRealResults); } - [Test, Category("MultiCore")] + [Test, Category(Categories.MultiCore)] [TestCase("DesignBishopGrid1Core.xml")] [TestCase("DesignBishopGrid2Cores.xml")] [TestCase("DesignBishopGrid4Cores.xml")] @@ -114,43 +103,26 @@ Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; string inputString = File.ReadAllText(fullInputFilename); var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); engineInterface.DamProjectData.ProjectPath = @"MultiCore\"; - string result = engineInterface.Validate(); - Assert.IsTrue(result == null, "Validation must succeed but does not, see output xml in debugger"); - string outputString = engineInterface.Run(); - File.WriteAllText("Output.xml", outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.IsTrue(engineInterface.DamProjectData.DamProjectType == DamProjectType.Design); + + Output output = GeneralHelper.RunAfterInputValidation(engineInterface, true, "Output.xml"); + int errorCount = GeneralHelper.DetermineNumberOfCalculationErrors(engineInterface.DamProjectData.CalculationMessages); Assert.AreEqual(0, errorCount, "There should be no errors during the calculation."); Assert.AreEqual(output.Results.CalculationMessages.Length, engineInterface.DamProjectData.CalculationMessages.Count); - if (engineInterface.DamProjectData.DamProjectType == DamProjectType.Design) - { - Assert.IsNotNull(output.Results.CalculationResults); - } - else - { - Assert.AreEqual(8, output.Results.OperationalOutputTimeSeries.Length); - int numberOfResults = 0; - int numberOfRealResults = 0; - foreach (TimeSerie resultSerie in output.Results.OperationalOutputTimeSeries) - { - numberOfResults += resultSerie.Entries.TimeSerieEntry.Length; - foreach (TimeSerieEntriesTimeSerieEntry timeSerieEntriesTimeSerieEntry in resultSerie.Entries.TimeSerieEntry) - { - if (!Double.IsNaN(timeSerieEntriesTimeSerieEntry.Value) && - timeSerieEntriesTimeSerieEntry.Value is > 0 and < 100000) - { - numberOfRealResults++; - } - } - } - Assert.AreEqual(16, numberOfResults); - Assert.AreEqual(16, numberOfRealResults); - } + Assert.AreEqual(8, output.Results.CalculationResults.Length); + Assert.AreEqual(1.409, output.Results.CalculationResults[0].StabilityDesignResults.SafetyFactor, tolerance3Decimals); + Assert.AreEqual(1.331, output.Results.CalculationResults[1].StabilityDesignResults.SafetyFactor, tolerance3Decimals); + Assert.AreEqual(1.206, output.Results.CalculationResults[2].StabilityDesignResults.SafetyFactor, tolerance3Decimals); + Assert.AreEqual(1.475, output.Results.CalculationResults[3].StabilityDesignResults.SafetyFactor, tolerance3Decimals); + Assert.AreEqual(1.248, output.Results.CalculationResults[4].StabilityDesignResults.SafetyFactor, tolerance3Decimals); + Assert.AreEqual(1.223, output.Results.CalculationResults[5].StabilityDesignResults.SafetyFactor, tolerance3Decimals); + Assert.AreEqual(1.393, output.Results.CalculationResults[6].StabilityDesignResults.SafetyFactor, tolerance3Decimals); + Assert.AreEqual(1.373, output.Results.CalculationResults[7].StabilityDesignResults.SafetyFactor, tolerance3Decimals); } - - [Test, Category("MultiCore")] + + [Test, Category(Categories.MultiCore)] [TestCase(1)] [TestCase(10)] [TestCase(24)] @@ -163,11 +135,10 @@ var engineInterface = new EngineInterface(inputString); Assert.IsNotNull(engineInterface.DamProjectData); engineInterface.DamProjectData.MaxCalculationCores = maxCores; - string result = engineInterface.Validate(); - Assert.IsTrue(result == null, "Validation must succeed but does not, see output xml in debugger"); - string outputString = engineInterface.Run(); - string outputName = "Output" + maxCores + ".xml"; - File.WriteAllText(outputName, outputString); + Assert.IsTrue(engineInterface.DamProjectData.DamProjectType == DamProjectType.Operational); + + Output output = GeneralHelper.RunAfterInputValidation(engineInterface, true, "Output" + maxCores + ".xml"); + //Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); //TimeSerieCollection outputTimeSeriesCollection = new TimeSerieCollection(); //outputTimeSeriesCollection.Series.AddRange(engineInterface.DamProjectData.OutputTimeSerieCollection.Series); @@ -179,8 +150,8 @@ CheckLargeResultsSets.CheckResultsOperationalBeeSwarmMultiCoreWithXmlInputFile(series); } - - [Test, Category("MultiCore")] + + [Test, Category(Categories.MultiCore)] [TestCase(1)] [TestCase(4)] [TestCase(16)] @@ -205,18 +176,16 @@ { Directory.Delete(calcDir, true); // delete previous results } - string result = engineInterface.Validate(); - Assert.IsTrue(result == null, "Validation must succeed but does not, see output xml in debugger"); - string outputString = engineInterface.Run(); - File.WriteAllText("Results_Cores_" + maxCores + ".xml", outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(engineInterface, true, "Results_Cores_" + maxCores + ".xml"); + Assert.AreEqual(18, output.Results.CalculationResults.Length); Assert.AreEqual(24,output.Results.CalculationMessages.Length); CheckLargeResultsSets.CheckResultsDesignBishopWithScenariosForHeadPl3CalculatesCorrect(output.Results.CalculationResults); } - - [Test, Category("MultiCore")] + + [Test, Category(Categories.MultiCore)] [TestCase(4, true)] [TestCase(16, true)] [TestCase(23, true)] @@ -286,7 +255,6 @@ Assert.AreEqual(18, resultsFound); } } - private static void RemoveTestWorkingDirectory() { Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalPulauTekongTests.cs =================================================================== diff -u -r4231 -r4474 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalPulauTekongTests.cs (.../OperationalPulauTekongTests.cs) (revision 4231) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalPulauTekongTests.cs (.../OperationalPulauTekongTests.cs) (revision 4474) @@ -55,7 +55,6 @@ } [Test] - [Ignore("")] [Category(Categories.WorkInProgress)] [TestCase(@"PulauTekong.InputFile.xml", 2.486106, 2.114159)] [TestCase(@"PulauTekong.InputFile-NoValues.xml", novalue, novalue)] @@ -77,20 +76,16 @@ inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", baseTestDirectory + @"PulauTekong.geometries2D.0\"); inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", baseTestDirectory + @"PulauTekong0.soilmaterials.mdb"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); - File.WriteAllText(outputFileName, outputString, Encoding.Unicode); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(inputString, true, outputFileName); Assert.AreEqual(stabilityOutsideFactor, output.Results.OperationalOutputTimeSeries[0].ParameterId); Assert.AreEqual(valueEntry1, output.Results.OperationalOutputTimeSeries[0].Entries.TimeSerieEntry[0].Value, tolerance); Assert.AreEqual(stabilityOutsideFactor, output.Results.OperationalOutputTimeSeries[1].ParameterId); Assert.AreEqual(valueEntry2, output.Results.OperationalOutputTimeSeries[1].Entries.TimeSerieEntry[0].Value, tolerance); } - [Test, Category("MultiCore")] + [Test, Category(Categories.MultiCore)] // This test runs the same project as Run_UsingTestFiles_HasExpectedResultsInOutputFile // except that it runs it with both single core and multi core. // The output of both runs must be the same Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCorePipingCalculationTests.cs =================================================================== diff -u -r4383 -r4474 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCorePipingCalculationTests.cs (.../MultiCorePipingCalculationTests.cs) (revision 4383) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MultiCorePipingCalculationTests.cs (.../MultiCorePipingCalculationTests.cs) (revision 4474) @@ -59,27 +59,16 @@ // Calculate one core Debug.WriteLine("Perform single core calculation Piping"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); - Output outputOneCore = DamXmlSerialization.LoadOutputFromXmlString(outputString); - Assert.IsNotNull(outputOneCore.Results.CalculationResults, "No results available"); string outputFilename = DetermineOutputFilename(fileNameOutputPrefix, pipingModelType.ToString(), 1); - File.WriteAllText(outputFilename, outputString, Encoding.Unicode); - + Output outputOneCore = GeneralHelper.RunAfterInputValidation(inputString, true, outputFilename); + // Calculate multicore Debug.WriteLine(""); Debug.WriteLine("Perform multicore calculation with {0} cores Piping", multiCoreCount); inputString = XmlAdapter.ChangeValueInXml(inputString, "MaxCalculationCores", multiCoreCount.ToString()); - engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); - Output outputMultiCore = DamXmlSerialization.LoadOutputFromXmlString(outputString); outputFilename = DetermineOutputFilename(fileNameOutputPrefix, pipingModelType.ToString(), multiCoreCount); - File.WriteAllText(outputFilename, outputString, Encoding.Unicode); - + Output outputMultiCore = GeneralHelper.RunAfterInputValidation(inputString, true, outputFilename); + // Compare the results var differences = new List(); var differencesStringBuilder = new StringBuilder(); Index: DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/GeneralHelper.cs =================================================================== diff -u -r4172 -r4474 --- DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/GeneralHelper.cs (.../GeneralHelper.cs) (revision 4172) +++ DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/GeneralHelper.cs (.../GeneralHelper.cs) (revision 4474) @@ -19,8 +19,17 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Collections.Generic; +using System.IO; +using System.Text; +using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.Standard.Logging; +using Deltares.DamEngine.Interface; +using Deltares.DamEngine.Io; +using Deltares.DamEngine.Io.XmlOutput; +using DGeoSuite.Common; +using NUnit.Framework; namespace Deltares.DamEngine.TestHelpers; @@ -39,4 +48,59 @@ return errorCount; } + + public static Output RunAfterInputValidation(string inputString, bool areResultsExpected = true, string outputXml = "") + { + var engineInterface = new EngineInterface(inputString); + return RunAfterInputValidation(engineInterface, areResultsExpected, outputXml); + } + + public static Output RunAfterInputValidation(EngineInterface engineInterface, bool areResultsExpected = true, string outputXml = "") + { + Assert.IsNotNull(engineInterface.DamProjectData); + string validationMessages = engineInterface.Validate(); + string extraValidationMessage = ""; + if (outputXml != "") + { + extraValidationMessage = ", see output xml in debugger"; + } + Assert.IsNull(validationMessages, "Validation should succeed but does not" + extraValidationMessage); + string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); + Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + if (outputXml != "") + { + File.WriteAllText("Output.xml", outputString, Encoding.Unicode); + } + if (!areResultsExpected) + { + return output; + } + bool isNoResultAvailable; + switch (engineInterface.DamProjectData.DamProjectType) + { + case DamProjectType.Design: + isNoResultAvailable = output.Results.CalculationResults.IsNullOrEmpty(); + break; + default: + isNoResultAvailable = output.Results.OperationalOutputTimeSeries.IsNullOrEmpty(); + break; + } + if (!isNoResultAvailable) + { + return output; + } + string assertMessage = "No results available."; + foreach (var calcMessage in output.Results.CalculationMessages) + { + if ((calcMessage.MessageType == MessageMessageType.Error) & calcMessage.Message1.Contains("The preparation for this calculation failed")) + { + assertMessage = "No results available due to dependency on 2D geometries (sti files) and the old MacroStability kernel wrapper implementation"; + Assert.IsNotNull(output.Results.CalculationResults, assertMessage); + } + assertMessage = assertMessage + Environment.NewLine + calcMessage.Message1; + } + Assert.IsNotNull(output.Results.CalculationResults, assertMessage); + return output; + } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalIntegrationTests.cs =================================================================== diff -u -r4231 -r4474 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalIntegrationTests.cs (.../OperationalIntegrationTests.cs) (revision 4231) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalIntegrationTests.cs (.../OperationalIntegrationTests.cs) (revision 4474) @@ -38,7 +38,6 @@ private const double tolerance = 0.0005; [Test] - [Ignore("")] [Category(Categories.WorkInProgress)] public void Run_UsingTestFiles_HasExpectedResultsInOutputFile() { @@ -58,18 +57,15 @@ inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\output.Geometries\"); inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\output0.soilmaterials.mdb"); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); - File.WriteAllText(outputFileName, outputString, Encoding.Unicode); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(inputString, true, outputFileName); + Assert.AreEqual(1.226, output.Results.OperationalOutputTimeSeries[0].Entries.TimeSerieEntry[0].Value, tolerance); Assert.AreEqual(1.244, output.Results.OperationalOutputTimeSeries[1].Entries.TimeSerieEntry[0].Value, tolerance); Assert.AreEqual(1.311, output.Results.OperationalOutputTimeSeries[2].Entries.TimeSerieEntry[0].Value, tolerance); } - [Test] + [Test, Category(Categories.WorkInProgress)] // This test runs the same project as Run_UsingTestFiles_HasExpectedResultsInOutputFile // except that it runs it with both single core and multi core. // The output of both runs must be the same @@ -104,11 +100,7 @@ inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\output.Geometries\"); inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\output0.soilmaterials.mdb"); inputString = XmlAdapter.ChangeValueInXml(inputString, "MaxCalculationCores", coreCount.ToString()); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); - File.WriteAllText(outputFileName, outputString, Encoding.Unicode); - Assert.IsNotNull(outputString); - return DamXmlSerialization.LoadOutputFromXmlString(outputString); + + return GeneralHelper.RunAfterInputValidation(inputString, false); } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/WtiPipingSellmeijerRevisedTests.cs =================================================================== diff -u -r4358 -r4474 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/WtiPipingSellmeijerRevisedTests.cs (.../WtiPipingSellmeijerRevisedTests.cs) (revision 4358) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/WtiPipingSellmeijerRevisedTests.cs (.../WtiPipingSellmeijerRevisedTests.cs) (revision 4474) @@ -291,14 +291,10 @@ const string fileName = @"WtiPipingSellmeijerRevisedWithoutUplift.xml"; string inputString = File.ReadAllText(fileName); var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - engineInterface.DamProjectData.MaxCalculationCores = maxCores; - string result = engineInterface.Validate(); - Assert.IsTrue(result == null, "Validation must succeed but does not, see output xml in debugger"); - string outputString = engineInterface.Run(); string outputName = "Output" + maxCores + ".xml"; - File.WriteAllText(outputName, outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(engineInterface, true, outputName); + int errorCount = GeneralHelper.DetermineNumberOfCalculationErrors(engineInterface.DamProjectData.CalculationMessages); Assert.AreEqual(0, errorCount, "There should be no errors during the calculation."); Assert.AreNotEqual(null, output.Results.CalculationResults); Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalGrebbedijkTests.cs =================================================================== diff -u -r4448 -r4474 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalGrebbedijkTests.cs (.../OperationalGrebbedijkTests.cs) (revision 4448) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalGrebbedijkTests.cs (.../OperationalGrebbedijkTests.cs) (revision 4474) @@ -57,8 +57,7 @@ } [Test] - [Ignore("#Bka: this is a Bishop 2D test. So as soon as that model and geometry type is implemented it must be activated and made to work again.")] - [Category("Work_In_Progress")] + [Category(Categories.WorkInProgress)] public void Run_UsingTestFiles_HasExpectedResultsInOutputFile() { const string calcDir = "TestOperationalGrebbedijk"; @@ -92,12 +91,8 @@ dikeLocation.Scenarios.Add(scenario); } - string result = engineInterface.Validate(); - Assert.IsNull(result, "Validation must succeed but does not, see validation output xml in debugger"); - string outputString = engineInterface.Run(); - File.WriteAllText(outputFileName, outputString, Encoding.Unicode); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Output output = GeneralHelper.RunAfterInputValidation(inputString, true, outputFileName); + Assert.AreEqual(2.321, output.Results.OperationalOutputTimeSeries[0].Entries.TimeSerieEntry[0].Value, tolerance); Assert.AreEqual(2.321, output.Results.OperationalOutputTimeSeries[0].Entries.TimeSerieEntry[1].Value, tolerance); // Following values were 0.590 in the previous DamLive version, but that has to do with how the @@ -108,6 +103,7 @@ [TestCase(PipingModelType.Wti2017)] [TestCase(PipingModelType.Bligh)] + [Category(Categories.WorkInProgress)] public void Run_UsingTestFiles_ButWithSupportedPipingModelFailsBecauseNoRelevantSegments(PipingModelType pipingModel) { const string calcDir = "TestOperationalGrebbedijk"; @@ -129,9 +125,9 @@ Assert.IsNotNull(engineInterface.DamProjectData); engineInterface.DamProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismSystemType = FailureMechanismSystemType.Piping; engineInterface.DamProjectData.DamProjectCalculationSpecification.CurrentSpecification.PipingModelType = pipingModel; - string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(engineInterface, false); + Assert.AreEqual(2, output.Results.CalculationMessages.Length); Assert.AreEqual(MessageMessageType.Info, output.Results.CalculationMessages[0].MessageType); Assert.AreEqual("There are 2 locations with sensor data", output.Results.CalculationMessages[0].Message1); Index: DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Categories.cs =================================================================== diff -u -r4052 -r4474 --- DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Categories.cs (.../Categories.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/Categories.cs (.../Categories.cs) (revision 4474) @@ -23,5 +23,18 @@ public static class Categories { + /// + /// The failing tests that should be solved quickly. + /// public const string WorkInProgress = "Work_In_Progress"; + + /// + /// The slow tests (running takes more than ~10s). + /// + public const string Slow = "Slow"; + + /// + /// Tests for multi-core. + /// + public const string MultiCore = "MultiCore"; } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs =================================================================== diff -u -r4462 -r4474 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 4462) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 4474) @@ -69,9 +69,9 @@ } /// Test for different segmentFailureMechanismType - /// The soilprobabilities are set tot the specified segmentFailureMechanismType - [Test, Category("Slow")] - [Ignore("Test disabled due to dependency on 2D geometries (sti files) and the old MacroStability kernel wrapper implementation")] + /// The soil probabilities are set tot the specified segmentFailureMechanismType + [Test, Category(Categories.Slow)] + [Category(Categories.WorkInProgress)] [TestCase(ConversionHelper.InputSegmentFailureMechanismStability)] [TestCase(ConversionHelper.InputSegmentFailureMechanismAll)] public void TestRunMacroStabilityTutorialDesignBishop(int segmentFailureMechanismType) @@ -98,13 +98,9 @@ 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(); - - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); + Assert.IsNotNull(output.Results.CalculationResults, "No results available"); Assert.AreEqual(1.282, output.Results.CalculationResults[0].StabilityDesignResults.SafetyFactor, tolerance); @@ -134,8 +130,8 @@ Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[0].CalculationResult)); } - [Test, Category("Slow")] - [Ignore("Test disabled due to dependency on 2D geometries (sti files) and the old MacroStability kernel wrapper implementation")] + [Test, Category(Categories.Slow)] + [Category(Categories.WorkInProgress)] public void TestRunMacroStabilityTutorialDesignUpliftVan() { // Based on ".data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx" @@ -155,13 +151,9 @@ 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); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); - string outputString = engineInterface.Run(); - - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); Assert.AreEqual(1.115, output.Results.CalculationResults[0].StabilityDesignResults.SafetyFactor, tolerance); // NumberOfIterations=0 @@ -190,8 +182,8 @@ Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[0].CalculationResult)); } - [Test, Category("Slow")] - [Ignore("Test disabled due to dependency on 2D geometries (sti files) and the old MacroStability kernel wrapper implementation")] + [Test, Category(Categories.Slow)] + [Category(Categories.WorkInProgress)] public void TestRunMacroStabilityTutorialDesignBishopUpliftVan_UpliftVanLowest() { // Based on ".data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx" @@ -211,13 +203,9 @@ 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); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); - 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); @@ -244,8 +232,8 @@ 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")] + [Test, Category(Categories.Slow)] + [Category(Categories.WorkInProgress)] public void TestRunMacroStabilityTutorialDesignBishopUpliftVan_BishopLowest() { // Based on ".data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx" @@ -265,13 +253,9 @@ 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); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); - 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); @@ -295,8 +279,8 @@ 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")] + [Test, Category(Categories.Slow)] + [Category(Categories.WorkInProgress)] public void TestRunMacroStabilityTutorialDesignBishopUpliftVan_NoUplift() { // Based on ".data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx" @@ -316,13 +300,9 @@ 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); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); - string outputString = engineInterface.Run(); - - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); // Bishop DesignResultStabilityDesignResults result = output.Results.CalculationResults[0].StabilityDesignResults; Assert.IsTrue(result.SafetyFactorSpecified); @@ -348,8 +328,8 @@ 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")] + [Test, Category(Categories.Slow)] + [Category(Categories.WorkInProgress)] public void TestRunMacroStabilityInvoer10ForbiddenZoneBishop() { // Expected results are determined by running dam\dam clients\DamUI\trunk\data\DamEngineTestProjects\Invoer10\ZoneType.damx @@ -375,16 +355,11 @@ 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); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); - string outputString = engineInterface.Run(); - - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - 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); @@ -400,7 +375,7 @@ Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); } - [Test, Category("Slow")] + [Test, Category(Categories.Slow)] public void TestRunMacroStabilityWithErrorUpliftVan() { // Expected results are determined by running .\data\DamEngineTestProjects\DeltaDijk_zonering_BI\DeltaDijk normal.damx @@ -423,16 +398,9 @@ 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); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); - string outputString = engineInterface.Run(); - - 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); @@ -467,8 +435,8 @@ Assert.AreEqual(2.300, result.StabilityDesignResults.SafetyFactor, tolerance); } - [Test, Category("Slow")] - [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")] + [Test, Category(Categories.Slow)] + [Category(Categories.WorkInProgress)] public void TestRunMacroStabilityWithErrorBishopUpliftVan() { // Expected results are determined by running .\data\DamEngineTestProjects\DeltaDijk_zonering_BI\DeltaDijk normal.damx @@ -491,18 +459,11 @@ 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); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); - string outputString = engineInterface.Run(); - - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - - Assert.AreEqual(12, output.Results.CalculationResults.Length); - + var expectedCount = output.Results.CalculationResults.Length; + Assert.AreEqual(12, expectedCount, "12 results expected but only " + expectedCount); 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); @@ -531,7 +492,7 @@ Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan, result.StabilityDesignResults.StabilityModelType); } - [Test, Category("Slow")] + [Test, Category(Categories.Slow)] public void TestRunFailedExpectCalculationMessageInOptimizedSlopeAndShoulderAdaption() { // Inputfile was created with .\data\DamEngineTestProjects\Invoer2\DAM Tutorial Design\DAM Tutorial Design.damx @@ -551,21 +512,17 @@ 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); + + Output output = GeneralHelper.RunAfterInputValidation(inputString, false); - string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); - - 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); } - [Test, Category("Slow")] + [Test, Category(Categories.Slow)] public void DesignBishopOptimizedSlopeAndShoulderAdaptionWithScenariosForHeadPL3CalculatesCorrect() { const string inputFilename = "InputFileMultiCoreTestForScenarioAdaption.xml"; @@ -596,38 +553,31 @@ Assert.AreEqual(18, resultsFound); } - [Test, Category("Slow")] + [Test, Category(Categories.Slow)] public void TestRunSlopeAdaptionBeforeShoulderAdaptionSucceeds() { - // Inputfile was created with .\data\Dam\Benchmarks\Validatie SlopeAdaption\SlopeAdaption.damx + // Input file 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); 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); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); - string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); - - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - Assert.IsNotNull(output.Results.CalculationResults); - 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")] + [Test, Category(Categories.Slow)] + [Category(Categories.WorkInProgress)] // 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) @@ -655,13 +605,9 @@ 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(); - - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); + DamProjectData actualDamProjectData = FillDamFromXmlOutput.CreateDamProjectData(null, output); Assert.AreEqual(calculationResult, ConversionHelper.ConvertToCalculationResult( @@ -703,14 +649,10 @@ 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(); - - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - Assert.AreEqual(null, output.Results.CalculationResults); + + Output output = GeneralHelper.RunAfterInputValidation(inputString, false); + + Assert.IsNull(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); @@ -721,10 +663,8 @@ { 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); + Output output = GetOutputStringForProject(analysisType, false); + 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': " + @@ -736,15 +676,13 @@ { 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); + Output output = GetOutputStringForProject(analysisType, false); + Assert.IsNull(output.Results.CalculationResults, "Should have results available"); Assert.AreEqual(2, output.Results.CalculationMessages.Length); } - [Test, Category("Slow")] + [Test, Category(Categories.Slow)] public void TestRunMacroStabilityDeltaDijkBishopWith1DProducesStixFiles() { // Expected results are taken as is from the first run with the new kernel @@ -767,15 +705,9 @@ 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"); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - - string outputString = engineInterface.Run(); - - 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); @@ -820,7 +752,7 @@ } } - [Test, Category("Slow")] + [Test, Category(Categories.Slow)] public void TestRunMacroStabilityDeltaDijkUpliftVanWith1DProducesStixFiles() { // Expected results are taken as is from the first run with the new kernel @@ -844,14 +776,9 @@ 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); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); - string outputString = engineInterface.Run(); - - 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); @@ -890,7 +817,7 @@ } } - [Test, Category("Slow")] + [Test, Category(Categories.Slow)] public void TestRunMacroStabilityDeltaDijkBishopUpliftVanWith1DWithUpliftProducesStixFiles() { // Expected results are taken as is from the first run with the new kernel @@ -913,15 +840,9 @@ 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"); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - - string outputString = engineInterface.Run(); - - 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); @@ -965,7 +886,7 @@ } } - [Test, Category("Slow")] + [Test, Category(Categories.Slow)] public void TestRunMacroStabilityDeltaDijkBishopUpliftVanWith1DWithoutUpliftProducesStixFiles() { // Expected results are taken as is from the first run with the new kernel @@ -989,15 +910,9 @@ 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"); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - - string outputString = engineInterface.Run(); - - 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); @@ -1059,7 +974,7 @@ } } - private static string GetOutputStringForProject(string analysisType) + private static Output GetOutputStringForProject(string analysisType, bool areResultsExpected) { const string calcDir = "TestStabInwardsBishop"; if (Directory.Exists(calcDir)) @@ -1079,14 +994,10 @@ @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); inputString = XmlAdapter.ChangeValueInXml(inputString, "SegmentFailureMechanismType", ConversionHelper.InputSegmentFailureMechanismStability.ToString()); - + inputString = XmlAdapter.ChangeValueInXml(inputString, "AnalysisType", analysisType); - - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - - string outputString = engineInterface.Run(); - return outputString; + + return GeneralHelper.RunAfterInputValidation(inputString, areResultsExpected); } private string ChangeInputModel(string input, InputStabilityModelType modelType) Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/PipingBlighTests.cs =================================================================== diff -u -r4234 -r4474 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/PipingBlighTests.cs (.../PipingBlighTests.cs) (revision 4234) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/PipingBlighTests.cs (.../PipingBlighTests.cs) (revision 4474) @@ -67,18 +67,15 @@ const string fileName = @"PipingVoorbeeld1_BlighInputFile.xml"; string inputString = File.ReadAllText(fileName); inputString = XmlAdapter.ChangeValueInXml(inputString, "SegmentFailureMechanismType", segmentFailureMechanismType.ToString()); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); // Factor piping = 0.521 // Kritische hoogte = 1.667 // Factor opdrijven = 0.5825 - // Kwelweglengte piping = 25.0 - // Intredepunt x-lokaal = 10.0 + // Kwelweglengte piping = 25.0 + // Intredepunt x-lokaal = 10.0 // Uittredepunt x-lokaal = 35.0 // Opdrijven = true // Profielnaam = soilprofile_01 - // PL3 opdrijven = 0.582 + // PL3 opdrijven = 0.582 // PL3 stijghoogte aangepast = 1.262 // PL3 locatie opdrijven lokaal = 35.0 // PL4 opdrijven = 0.0 @@ -87,9 +84,8 @@ // Locatie naam = "profiel 1" // ID locatie scenario = "1" // Heave Factor = 90.0 - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); - Assert.IsNotNull(output.Results.CalculationResults, "No results available"); + Output output = GeneralHelper.RunAfterInputValidation(inputString); + DamProjectData actualDamProjectData = FillDamFromXmlOutput.CreateDamProjectData(null, output); SurfaceLine2 redesignedSurfaceLine = actualDamProjectData.DesignCalculations[0].PipingDesignResults.RedesignedSurfaceLine; Assert.AreEqual(0.521, output.Results.CalculationResults[0].PipingDesignResults.BlighFactor, tolerance); @@ -121,11 +117,9 @@ // Select all locations const string fileName = @"Rechter Diezedijk_BlighInputFile.xml"; string inputString = File.ReadAllText(fileName); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); + Assert.AreEqual(112, output.Results.CalculationResults.Length); Assert.AreEqual(0.782, output.Results.CalculationResults[0].PipingDesignResults.BlighFactor, tolerance); Assert.AreEqual(0.809, output.Results.CalculationResults[111].PipingDesignResults.BlighFactor, tolerance); @@ -139,11 +133,9 @@ // Set Analysis type to "Adapt geometry" const string fileName = @"PipingVoorbeeld1_BlighDesignInputFile.xml"; string inputString = File.ReadAllText(fileName); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); + DamProjectData actualDamProjectData = FillDamFromXmlOutput.CreateDamProjectData(null, output); SurfaceLine2 redesignedSurfaceLine = actualDamProjectData.DesignCalculations[0].PipingDesignResults.RedesignedSurfaceLine; Assert.AreEqual(true, output.Results.CalculationResults[0].PipingDesignResults.UpliftSituation.IsUplift); @@ -182,11 +174,9 @@ // Select second location (101) const string fileName = @"Rechter Diezedijk_BlighDesignInputFile_1Location.xml"; string inputString = File.ReadAllText(fileName); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); + var locationIndex = 0; Assert.AreEqual(1.313, output.Results.CalculationResults[locationIndex * 2 + 0].PipingDesignResults.BlighFactor, tolerance); Assert.AreEqual(1.295, output.Results.CalculationResults[locationIndex * 2 + 1].PipingDesignResults.BlighFactor, tolerance); @@ -205,10 +195,9 @@ Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; const string fileName = @"Rechter Diezedijk_BlighFailedDesignInputFile_1Location.xml"; string inputString = File.ReadAllText(fileName); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); + Assert.AreEqual(2, output.Results.CalculationResults.Length); Assert.AreEqual("The new shoulder length is too large to fit in the current surface line.", output.Results.CalculationResults[1].PipingDesignResults.ResultMessage); Assert.AreEqual(CalculationResult.RunFailed, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[1].CalculationResult)); @@ -229,11 +218,9 @@ // Select first 5 locations (100, 101, 102, 103 and 104) const string fileName = @"Rechter Diezedijk_BlighDesignInputFile.xml"; string inputString = File.ReadAllText(fileName); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); + var locationIndex = 0; Assert.AreEqual(1.516, output.Results.CalculationResults[locationIndex + 0].PipingDesignResults.BlighFactor, tolerance); Assert.AreEqual(1.497, output.Results.CalculationResults[locationIndex + 1].PipingDesignResults.BlighFactor, tolerance); @@ -261,14 +248,10 @@ const string fileName = @"PipingBlighWithoutUplift.xml"; string inputString = File.ReadAllText(fileName); var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - engineInterface.DamProjectData.MaxCalculationCores = maxCores; - string result = engineInterface.Validate(); - Assert.IsTrue(result == null, "Validation must succeed but does not, see output xml in debugger"); - string outputString = engineInterface.Run(); string outputName = "Output" + maxCores + ".xml"; - File.WriteAllText(outputName, outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(engineInterface, true, outputName); + int errorCount = GeneralHelper.DetermineNumberOfCalculationErrors(engineInterface.DamProjectData.CalculationMessages); Assert.AreEqual(0, errorCount, "There should be no errors during the calculation."); Assert.AreNotEqual(null, output.Results.CalculationResults); Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityOutwardsTests.cs =================================================================== diff -u -r4052 -r4474 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityOutwardsTests.cs (.../MacroStabilityOutwardsTests.cs) (revision 4052) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityOutwardsTests.cs (.../MacroStabilityOutwardsTests.cs) (revision 4474) @@ -23,6 +23,7 @@ using Deltares.DamEngine.Interface; using Deltares.DamEngine.Io; using Deltares.DamEngine.Io.XmlOutput; +using Deltares.DamEngine.TestHelpers; using NUnit.Framework; namespace Deltares.DamEngine.IntegrationTests.IntegrationTests; @@ -45,15 +46,11 @@ } Directory.CreateDirectory(calcDir); - string fullFileName = @"TestFiles\" + fileName; string inputString = File.ReadAllText(fullFileName); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - string outputString = engineInterface.Run(); - - Assert.IsNotNull(outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Output output = GeneralHelper.RunAfterInputValidation(inputString); + Assert.IsNotNull(output.Results.CalculationResults, "Results available when not expected"); Assert.AreEqual(factorOfSafety, output.Results.CalculationResults[0].StabilityDesignResults.SafetyFactor, Tolerance); } Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/DebuggingTest.cs =================================================================== diff -u -r4372 -r4474 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/DebuggingTest.cs (.../DebuggingTest.cs) (revision 4372) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/DebuggingTest.cs (.../DebuggingTest.cs) (revision 4474) @@ -51,25 +51,11 @@ string fullInputFilename = Path.Combine(mapTestFiles, inputFilename); Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; string inputString = File.ReadAllText(fullInputFilename); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - engineInterface.DamProjectData.MaxCalculationCores = maxCores; - string result = engineInterface.Validate(); - Assert.IsTrue(result == null, "Validation must succeed but does not, see output xml in debugger"); - string outputString = engineInterface.Run(); string outputName = "PipingVoorbeeld1_WtiSellmeijerRevisedInputFileOutput" + maxCores + ".xml"; - File.WriteAllText(outputName, outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + var engineInterface = new EngineInterface(inputString); + GeneralHelper.RunAfterInputValidation(engineInterface, true, outputName); int errorCount = GeneralHelper.DetermineNumberOfCalculationErrors(engineInterface.DamProjectData.CalculationMessages); Assert.AreEqual(0, errorCount, "There should be nor errors during the calculation."); - if (engineInterface.DamProjectData.DamProjectType == DamProjectType.Design) - { - Assert.AreNotEqual(null, output.Results.CalculationResults); - } - else - { - Assert.AreNotEqual(null, output.Results.OperationalOutputTimeSeries); - } } [Test, Ignore("This test is only used for debugging XML files generated by Dam UI")] @@ -82,25 +68,11 @@ string fullInputFilename = Path.Combine(mapTestFiles, fileName); Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; string inputString = File.ReadAllText(fullInputFilename); - var engineInterface = new EngineInterface(inputString); - Assert.IsNotNull(engineInterface.DamProjectData); - engineInterface.DamProjectData.MaxCalculationCores = maxCores; - string result = engineInterface.Validate(); - Assert.IsTrue(result == null, "Validation must succeed but does not, see output xml in debugger"); - string outputString = engineInterface.Run(); string outputName = fileName + maxCores + ".xml"; - File.WriteAllText(outputName, outputString); - Output output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + var engineInterface = new EngineInterface(inputString); + GeneralHelper.RunAfterInputValidation(engineInterface, true, outputName); + int errorCount = GeneralHelper.DetermineNumberOfCalculationErrors(engineInterface.DamProjectData.CalculationMessages); Assert.AreEqual(0, errorCount, "There should be nor errors during the calculation."); - if (engineInterface.DamProjectData.DamProjectType == DamProjectType.Design) - { - Assert.AreNotEqual(null, output.Results.CalculationResults); - } - else - { - Assert.AreNotEqual(null, output.Results.OperationalOutputTimeSeries); - } } - } \ No newline at end of file