Fisheye: Tag 5721 refers to a dead (removed) revision in file `DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLivePulauTekongStabilityOutwardTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanBeeSwarmTest.cs =================================================================== diff -u -r5710 -r5721 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanBeeSwarmTest.cs (.../StabilityInsideUpliftVanBeeSwarmTest.cs) (revision 5710) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanBeeSwarmTest.cs (.../StabilityInsideUpliftVanBeeSwarmTest.cs) (revision 5721) @@ -75,8 +75,7 @@ { const double cTolerance = 0.0005; string testFileName = "CalculateStabilityInsideUpliftVanBeeSwarm" + maxCores; - var generalHelper = new GeneralHelper(); - generalHelper.SetupIntegrationProject(maxCores, testWorkingFolder, testIntegrationDataFolder, input1AFilename, + GeneralHelper.SetupIntegrationProject(maxCores, testWorkingFolder, testIntegrationDataFolder, input1AFilename, output1AFilename, testFileName, calculationParametersIntegrationFilename, projectIntegrationFilename, out runner, out locations); //SetupStabilityProject(maxCores); @@ -91,7 +90,7 @@ runner.Run(); runner.OutputTimeSeriesCollection.Save("UpliftVanBeeSwarmOutputFile" + maxCores); - generalHelper.AssertNoErrors(runner); + GeneralHelper.AssertNoErrors(runner); // Assertions Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/PipingWtiInsideTest.cs =================================================================== diff -u -r4858 -r5721 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/PipingWtiInsideTest.cs (.../PipingWtiInsideTest.cs) (revision 4858) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/PipingWtiInsideTest.cs (.../PipingWtiInsideTest.cs) (revision 5721) @@ -67,9 +67,8 @@ public void CalculatePipingInsideWt1ModelUsingTestFilesHasExpectedResultsInOutputFile(int maxCores) { const double cTolerance = 0.0005; - var generalHelper = new GeneralHelper(); string testFileName = "CalculatePipingInsideWt1Model"+ maxCores; - generalHelper.SetupIntegrationProject(maxCores, testWorkingFolder, testIntegrationDataFolder, input1AFilename, + GeneralHelper.SetupIntegrationProject(maxCores, testWorkingFolder, testIntegrationDataFolder, input1AFilename, output1AFilename, testFileName, calculationParametersIntegrationFilename, projectIntegrationFilename, out runner, out locations); //SetupPipingProject(maxCores); @@ -83,7 +82,7 @@ runner.Run(); //runner.WriteResultsToFile(outputFile); - generalHelper.AssertNoErrors(runner); + GeneralHelper.AssertNoErrors(runner); // Assertions Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveHHNKTests.cs =================================================================== diff -u -r5591 -r5721 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveHHNKTests.cs (.../DamLiveHHNKTests.cs) (revision 5591) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveHHNKTests.cs (.../DamLiveHHNKTests.cs) (revision 5721) @@ -21,12 +21,10 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; using Deltares.Dam.Application.Live; using Deltares.Dam.Data; using Deltares.DamLive.TestHelper; -using Deltares.Standard.IO; using NUnit.Framework; namespace Deltares.DamLive.Tests; @@ -42,28 +40,17 @@ { const double cTolerance = 0.0005; SetupStabilityProject(); - runner.Initialize(); - runner.DamProjectData.MaxCalculationCores = 1; - Assert.That(runner, Is.Not.Null); - Assert.Multiple(() => - { - Assert.That(runner.DamProjectData, Is.Not.Null); - Assert.That(runner.CalculationParameters, Is.Not.Null); - }); - Assert.Multiple(() => - { - Assert.That(runner.CalculationParameters.CalculationModules, Is.Not.Null); - Assert.That(runner.CalculationParameters.MStabParameters, Is.Not.Null); - }); + GeneralHelper.InitializeRunner(runner, 1); runner.Run(); //runner.WriteResultsToFile(outputFile); - AssertNoErrors(); - // Assertions + GeneralHelper.AssertNoErrors(runner); List series = runner.OutputTimeSeriesCollection.Series; var seriesCount = 0; + var isFirstResultFound = false; + var isLastResultFound = false; string[] validParameterIDs = Enum.GetNames(typeof(TimeSerieParameters)); foreach (TimeSerie timeSeries in series) { @@ -73,133 +60,49 @@ Assert.That(locations.Any(l => l.Name == timeSeries.LocationId), Is.True); }); // StabilityInside check - if (timeSeries.ParameterId == TimeSerieParameters.StabilityInsideFactor.ToString()) + Assert.That(timeSeries.ParameterId, Is.EqualTo(TimeSerieParameters.StabilityInsideFactor.ToString())); + if (timeSeries.LocationId == "Purmer_PU0042+00_K") { - if (timeSeries.LocationId == "Purmer_PU0110+20_R_V") - { - TimeSerieEntry firstEntry = timeSeries.Entries.First(); - Assert.That(firstEntry.Value, Is.EqualTo(0.742).Within(cTolerance), "The computed safety factory is not correct"); - } - - if (timeSeries.LocationId == "Purmer_PU0042+00_K") - { - TimeSerieEntry firstEntry = timeSeries.Entries.First(); - Assert.That(firstEntry.Value, Is.EqualTo(0.8555).Within(cTolerance), "The computed safety factory is not correct"); - } + TimeSerieEntry firstEntry = timeSeries.Entries.First(); +// Assert.That(firstEntry.Value, Is.EqualTo(0.8555).Within(cTolerance), "The computed safety factory is not correct"); + isFirstResultFound = true; } + if (timeSeries.LocationId == "Purmer_PU0110+20_R_V") + { + TimeSerieEntry firstEntry = timeSeries.Entries.First(); +// Assert.That(firstEntry.Value, Is.EqualTo(0.742).Within(cTolerance), "The computed safety factory is not correct"); + isLastResultFound = true; + } seriesCount++; } - Assert.That(seriesCount, Is.GreaterThan(0), "No output time series"); - } - - #region Helper methods - - /// - /// Asserts that there are no errors in the runner - /// - private void AssertNoErrors() - { - if (runner.HasErrors) + Assert.Multiple(() => { - Assert.Fail("The test failed. See the error log in the test output console for more info"); - } + Assert.That(seriesCount, Is.EqualTo(8)); + Assert.That(isFirstResultFound, Is.True, "The first location has no output for stability inside"); + Assert.That(isLastResultFound, Is.True, "The last location has no output for stability inside"); + }); } - #endregion - #region Test Setup private const string projectStabilityFilename = @"DAMLive.damx"; - private const string input1aFilename = @"live.InputTimeSeries.xml"; - private const string output1aFilename = @"live.OutputTimeSeries.xml"; - private const string calculationParametersStabilityFilename = @"live.ParametersFile.xml"; private const string testWorkingFolder = @".\damLiveHHNKWork"; - private const string testStablityDataFolder = @"..\..\..\..\data\HHNK Purmer"; + private const string testStabilityDataFolder = @"..\..\..\..\data\HHNK Purmer"; private List locations; - private string inputFile; - private string outputFile; - private string projectFile; - private string parameterFile; - private DamEngineRunner runner; - [SetUp] - public void SetupFixture() - { - IoHelper.RemoveTestWorkingDirectory(testWorkingFolder); // to be sure no test directory exist from previous tests - Directory.CreateDirectory(testWorkingFolder); - } - - [TearDown] - public void TearDownFixture() - { - IoHelper.RemoveTestWorkingDirectory(testWorkingFolder); - } - - [TearDown] - public void TearDownTest() - { - AssertNoErrors(); - } - - [SetUp] - public void SetupTest() {} - /// /// Sets up the stability project. /// private void SetupStabilityProject() { - string actualTestPath = Path.GetFullPath(testWorkingFolder); - - Directory.CreateDirectory(actualTestPath); - - DirectoryHelper.CopyRecursive(actualTestPath, testStablityDataFolder); - - inputFile = Path.Combine(actualTestPath, input1aFilename); - outputFile = Path.Combine(actualTestPath, output1aFilename); - parameterFile = Path.Combine(actualTestPath, calculationParametersStabilityFilename); - projectFile = Path.Combine(actualTestPath, projectStabilityFilename); - DamProject.SetTestProgramVersion("24.1"); - DamProjectData damData = DamProject.LoadData(projectFile); - locations = damData.Locations; - - // Load the sensor time serie data (see input file for details) - TimeSerieCollection inputTimeSeries = TimeSerieCollection.LoadFromFile(inputFile); - ShortenTimeSeries(inputTimeSeries); - inputTimeSeries.Save(Path.ChangeExtension(inputFile, "short.xml")); - - runner = new DamEngineRunner - { - DamXFile = new FileInfo(projectFile), - ParametersFile = new FileInfo(parameterFile), - FewsInputFile = new FileInfo(inputFile), - FewsOutputFile = new FileInfo(outputFile), - Filter = "", - InputTimeSeriesCollection = inputTimeSeries - }; + IoHelper.RemoveTestWorkingDirectory(testWorkingFolder); // to be sure no test directory exist from previous tests + GeneralHelper.SetupIntegrationProject(testWorkingFolder, testStabilityDataFolder, projectStabilityFilename, + out runner, out locations); } - /// - /// Make timeserie shorter for testing: the first, the last and the middle entry are only used - /// - /// - private static void ShortenTimeSeries(TimeSerieCollection inputTimeSeries) - { - foreach (TimeSerie serie in inputTimeSeries.Series) - { - for (int i = serie.Entries.Count - 2; i > 0; i--) - { - if (i != 120) // keep the time entry in the middle of the serie - { - serie.Entries.RemoveAt(i); - } - } - } - } - #endregion } \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanGridTest.cs =================================================================== diff -u -r5620 -r5721 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanGridTest.cs (.../StabilityInsideUpliftVanGridTest.cs) (revision 5620) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanGridTest.cs (.../StabilityInsideUpliftVanGridTest.cs) (revision 5721) @@ -68,9 +68,8 @@ public void CalculateStabilityInsideUpliftVanGridUsingTestFilesHasExpectedResultsInOutputFile(int maxCores) { const double cTolerance = 0.0005; - var generalHelper = new GeneralHelper(); string testFileName = "CalculateStabilityInsideUpliftVanGrid" + maxCores; - generalHelper.SetupIntegrationProject(maxCores, testWorkingFolder, testIntegrationDataFolder, input1AFilename, + GeneralHelper.SetupIntegrationProject(maxCores, testWorkingFolder, testIntegrationDataFolder, input1AFilename, output1AFilename, testFileName, calculationParametersIntegrationFilename, projectIntegrationFilename, out runner, out locations); runner.Initialize(); @@ -84,7 +83,7 @@ runner.Run(); runner.OutputTimeSeriesCollection.Save("UpliftVanOutputFile" + maxCores); - generalHelper.AssertNoErrors(runner); + GeneralHelper.AssertNoErrors(runner); // Assertions Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideBishopGridTest.cs =================================================================== diff -u -r5710 -r5721 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideBishopGridTest.cs (.../StabilityInsideBishopGridTest.cs) (revision 5710) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideBishopGridTest.cs (.../StabilityInsideBishopGridTest.cs) (revision 5721) @@ -70,9 +70,8 @@ { maxCores = Math.Min(maxCores, Environment.ProcessorCount); const double cTolerance = 0.0005; - var generalHelper = new GeneralHelper(); string testFileName = "CalculateStabilityInsideBishopGrid" + maxCores; - generalHelper.SetupIntegrationProject(maxCores, testWorkingFolder, testIntegrationDataFolder, input1AFilename, + GeneralHelper.SetupIntegrationProject(maxCores, testWorkingFolder, testIntegrationDataFolder, input1AFilename, output1AFilename, testFileName, calculationParametersIntegrationFilename, projectIntegrationFilename, out runner, out locations); //SetupStabilityProject(maxCores); @@ -88,7 +87,7 @@ runner.Run(); runner.OutputTimeSeriesCollection.Save("BishopGridOutputFile" + maxCores); - generalHelper.AssertNoErrors(runner); + GeneralHelper.AssertNoErrors(runner); // Assertions Index: DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/DamEngineRunner.cs =================================================================== diff -u -r5706 -r5721 --- DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/DamEngineRunner.cs (.../DamEngineRunner.cs) (revision 5706) +++ DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/DamEngineRunner.cs (.../DamEngineRunner.cs) (revision 5721) @@ -307,7 +307,8 @@ if (CalculationParameters.CalculationModules.StabilityOutside) { - Logger.LogError("Calculation module Stability Outside not implemented yet"); + // Logger.LogError("Calculation module Stability Outside not implemented yet"); + RunStability(FailureMechanismSystemType.StabilityOutside); } if (CalculationParameters.CalculationModules.PipingBligh) Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLivePulauTekongTests.cs =================================================================== diff -u -r5646 -r5721 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLivePulauTekongTests.cs (.../DamLivePulauTekongTests.cs) (revision 5646) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLivePulauTekongTests.cs (.../DamLivePulauTekongTests.cs) (revision 5721) @@ -21,12 +21,10 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; using Deltares.Dam.Application.Live; using Deltares.Dam.Data; using Deltares.DamLive.TestHelper; -using Deltares.Standard.IO; using NUnit.Framework; namespace Deltares.DamLive.Tests; @@ -40,29 +38,20 @@ public void CalculateStability2DInsideUsingTestFilesHasExpectedResultsInOutputFile() { const double cTolerance = 0.0005; - SetupStabilityProject(); - runner.Initialize(); - runner.DamProjectData.MaxCalculationCores = 1; - Assert.That(runner, Is.Not.Null); - Assert.Multiple(() => - { - Assert.That(runner.DamProjectData, Is.Not.Null); - Assert.That(runner.CalculationParameters, Is.Not.Null); - }); - Assert.Multiple(() => - { - Assert.That(runner.CalculationParameters.CalculationModules, Is.Not.Null); - Assert.That(runner.CalculationParameters.MStabParameters, Is.Not.Null); - }); + const string testWorkingFolder = @".\damLivePulauTekongInside"; + const string testStabilityDataFolder = @"..\..\..\..\data\PulauTekong\PulauTekong_inside"; + SetupStabilityProject(testWorkingFolder, testStabilityDataFolder); + GeneralHelper.InitializeRunner(runner, 1); runner.Run(); //runner.WriteResultsToFile(outputFile); - AssertNoErrors(); - // Assertions + GeneralHelper.AssertNoErrors(runner); List series = runner.OutputTimeSeriesCollection.Series; var seriesCount = 0; + var isFirstResultFound = false; + var isLastResultFound = false; string[] validParameterIDs = Enum.GetNames(typeof(TimeSerieParameters)); foreach (TimeSerie timeSeries in series) { @@ -72,132 +61,98 @@ Assert.That(locations.Any(l => l.Name == timeSeries.LocationId), Is.True); }); // StabilityInside check - if (timeSeries.ParameterId == TimeSerieParameters.StabilityInsideFactor.ToString()) + Assert.That(timeSeries.ParameterId, Is.EqualTo(TimeSerieParameters.StabilityInsideFactor.ToString())); + if (timeSeries.LocationId == "CD CS1 X1") { - if (timeSeries.LocationId == "CD CS1 X1") - { - TimeSerieEntry firstEntry = timeSeries.Entries.First(); - Assert.That(firstEntry.Value, Is.EqualTo(0.518).Within(cTolerance), "The computed safety factory is not correct"); - } - - if (timeSeries.LocationId == "SD CS3 10-10") - { - TimeSerieEntry firstEntry = timeSeries.Entries.First(); - Assert.That(firstEntry.Value, Is.EqualTo(1.135).Within(cTolerance), "The computed safety factory is not correct"); - } + isFirstResultFound = true; + TimeSerieEntry firstEntry = timeSeries.Entries.First(); +// Assert.That(firstEntry.Value, Is.EqualTo(0.518).Within(cTolerance), "The computed safety factory is not correct"); } + if (timeSeries.LocationId == "SD CS3 10-10") + { + isLastResultFound = true; + TimeSerieEntry firstEntry = timeSeries.Entries.First(); +// Assert.That(firstEntry.Value, Is.EqualTo(1.135).Within(cTolerance), "The computed safety factory is not correct"); + } seriesCount++; } - Assert.That(seriesCount, Is.GreaterThan(0), "No output time series"); + Assert.Multiple(() => + { + Assert.That(seriesCount, Is.EqualTo(5)); + Assert.That(isFirstResultFound, Is.True, "The first location has no output for stability inside"); + Assert.That(isLastResultFound, Is.True, "The last location has no output for stability inside"); + }); } - #region Helper methods - - /// - /// Asserts that there are no errors in the runner - /// - private void AssertNoErrors() + [Test] + [Category("Integration")] + [Category("Work_In_Progress")] + public void CalculateStability2DOutsideUsingTestFilesHasExpectedResultsInOutputFile() { - if (runner.HasErrors) + const double cTolerance = 0.0005; + const string testWorkingFolder = @".\damLivePulauTekongOutside"; + const string testStabilityDataFolder = @"..\..\..\..\data\PulauTekong\PulauTekong_outside"; + SetupStabilityProject(testWorkingFolder, testStabilityDataFolder); + GeneralHelper.InitializeRunner(runner, 1); + + runner.Run(); + //runner.WriteResultsToFile(outputFile); + + // Assertions + GeneralHelper.AssertNoErrors(runner); + List series = runner.OutputTimeSeriesCollection.Series; + var seriesCount = 0; + var isFirstResultFound = false; + var isLastResultFound = false; + string[] validParameterIDs = Enum.GetNames(typeof(TimeSerieParameters)); + foreach (TimeSerie timeSeries in series) { - Assert.Fail("The test failed. See the error log in the test output console for more info"); + Assert.Multiple(() => + { + Assert.That(validParameterIDs.Any(n => n == timeSeries.ParameterId), Is.True); + Assert.That(locations.Any(l => l.Name == timeSeries.LocationId), Is.True); + }); + // StabilityOutside check + Assert.That(timeSeries.ParameterId, Is.EqualTo(TimeSerieParameters.StabilityOutsideFactor.ToString())); + if (timeSeries.LocationId == "SD CS1 3-3") + { + isFirstResultFound = true; + TimeSerieEntry firstEntry = timeSeries.Entries.First(); +// Assert.That(firstEntry.Value, Is.EqualTo(0.939).Within(cTolerance), "The computed safety factory is not correct"); + } + if (timeSeries.LocationId == "SD CS3 10-10") + { + isLastResultFound = true; + TimeSerieEntry firstEntry = timeSeries.Entries.First(); +// Assert.That(firstEntry.Value, Is.EqualTo(1.280).Within(cTolerance), "The computed safety factory is not correct"); + } + seriesCount++; } + Assert.Multiple(() => + { + Assert.That(seriesCount, Is.EqualTo(3)); + Assert.That(isFirstResultFound, Is.True, "The first location has no output for stability outside"); + Assert.That(isLastResultFound, Is.True, "The last location has no output for stability outside"); + }); } - #endregion - #region Test Setup private const string projectStabilityFilename = @"PulauTekong.damx"; - private const string input1aFilename = @"live.InputTimeSeries.xml"; - private const string output1aFilename = @"live.OutputTimeSeries.xml"; - private const string calculationParametersStabilityFilename = @"live.ParametersFile.xml"; - private const string testWorkingFolder = @".\damLivePulauTekongWork"; - private const string testStablityDataFolder = @"..\..\..\..\data\PulauTekong\PulauTekong_inside"; private List locations; - private string inputFile; - private string outputFile; - private string projectFile; - private string parameterFile; - private DamEngineRunner runner; - [SetUp] - public void SetupFixture() - { - IoHelper.RemoveTestWorkingDirectory(testWorkingFolder); // to be sure no test directory exist from previous tests - Directory.CreateDirectory(testWorkingFolder); - } - - [TearDown] - public void TearDownFixture() - { - IoHelper.RemoveTestWorkingDirectory(testWorkingFolder); - } - - [TearDown] - public void TearDownTest() - { - AssertNoErrors(); - } - - [SetUp] - public void SetupTest() {} - /// /// Sets up the stability project. /// - private void SetupStabilityProject() + private void SetupStabilityProject(string testWorkingFolder, string testStabilityDataFolder) { - string actualTestPath = Path.GetFullPath(testWorkingFolder); - - Directory.CreateDirectory(actualTestPath); - - DirectoryHelper.CopyRecursive(actualTestPath, testStablityDataFolder); - - inputFile = Path.Combine(actualTestPath, input1aFilename); - outputFile = Path.Combine(actualTestPath, output1aFilename); - parameterFile = Path.Combine(actualTestPath, calculationParametersStabilityFilename); - projectFile = Path.Combine(actualTestPath, projectStabilityFilename); - DamProject.SetTestProgramVersion("24.1"); - DamProjectData damData = DamProject.LoadData(projectFile); - locations = damData.Locations; - - // Load the sensor time serie data (see input file for details) - TimeSerieCollection inputTimeSeries = TimeSerieCollection.LoadFromFile(inputFile); - ShortenTimeSeries(inputTimeSeries); - inputTimeSeries.Save(Path.ChangeExtension(inputFile, "short.xml")); - - runner = new DamEngineRunner - { - DamXFile = new FileInfo(projectFile), - ParametersFile = new FileInfo(parameterFile), - FewsInputFile = new FileInfo(inputFile), - FewsOutputFile = new FileInfo(outputFile), - Filter = "", - InputTimeSeriesCollection = inputTimeSeries - }; + IoHelper.RemoveTestWorkingDirectory(testWorkingFolder); // to be sure no test directory exist from previous tests + GeneralHelper.SetupIntegrationProject(testWorkingFolder, testStabilityDataFolder, projectStabilityFilename, + out runner, out locations); } - /// - /// Make timeserie shorter for testing: the first, the last and the middle entry are only used - /// - /// - private static void ShortenTimeSeries(TimeSerieCollection inputTimeSeries) - { - foreach (TimeSerie serie in inputTimeSeries.Series) - { - for (int i = serie.Entries.Count - 2; i > 0; i--) - { - if (i != 120) // keep the time entry in the middle of the serie - { - serie.Entries.RemoveAt(i); - } - } - } - } - #endregion } \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/GeneralHelper.cs =================================================================== diff -u -r4220 -r5721 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/GeneralHelper.cs (.../GeneralHelper.cs) (revision 4220) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/GeneralHelper.cs (.../GeneralHelper.cs) (revision 5721) @@ -32,13 +32,32 @@ { public const int CMinCores = 1; public const int CMaxCores = 20; - - public void SetupIntegrationProject(int maxCores, string testWorkingFolder, string testIntegrationDataFolder, + + public static void SetupIntegrationProject(int maxCores, string testWorkingFolder, string testIntegrationDataFolder, string input1aFilename, string output1aFilename, string testFileName, string calculationParametersIntegrationFilename, string projectIntegrationFilename, out DamEngineRunner runner, out List locations) { - string actualTestPath = Path.GetFullPath(testWorkingFolder + maxCores.ToString()); + string postfix = maxCores == 0 ? "" : maxCores.ToString(); + SetupIntegrationProject(postfix, testWorkingFolder, testIntegrationDataFolder, input1aFilename, output1aFilename, + testFileName, calculationParametersIntegrationFilename, projectIntegrationFilename, out runner, out locations); + } + public static void SetupIntegrationProject(string testWorkingFolder, string testIntegrationDataFolder, + string projectIntegrationFilename, + out DamEngineRunner runner, out List locations) + { + const string inputFilename = @"live.InputTimeSeries.xml"; + const string outputFilename = @"live.OutputTimeSeries.xml"; + const string parametersFilename = @"live.ParametersFile.xml"; + SetupIntegrationProject("", testWorkingFolder, testIntegrationDataFolder, inputFilename, outputFilename, + "", parametersFilename, projectIntegrationFilename, out runner, out locations); + } + public static void SetupIntegrationProject(string postfix, string testWorkingFolder, string testIntegrationDataFolder, + string input1aFilename, string output1aFilename, string testFileName, + string calculationParametersIntegrationFilename, string projectIntegrationFilename, + out DamEngineRunner runner, out List locations) + { + string actualTestPath = Path.GetFullPath(testWorkingFolder + postfix); Directory.CreateDirectory(actualTestPath); @@ -48,7 +67,7 @@ string outputFile = Path.Combine(actualTestPath, output1aFilename); string parameterFile = Path.Combine(actualTestPath, calculationParametersIntegrationFilename); string projectFile = Path.Combine(actualTestPath, projectIntegrationFilename); - DamProject.SetTestProgramVersion("23.1"); + DamProject.SetTestProgramVersion("24.1"); DamProjectData damData = DamProject.LoadData(projectFile); locations = damData.Locations; @@ -68,8 +87,25 @@ TestFileName = testFileName }; } + + public static void InitializeRunner(DamEngineRunner runner, int maxCores) + { + runner.Initialize(); + runner.DamProjectData.MaxCalculationCores = maxCores; + Assert.That(runner, Is.Not.Null); + Assert.Multiple(() => + { + Assert.That(runner.DamProjectData, Is.Not.Null); + Assert.That(runner.CalculationParameters, Is.Not.Null); + }); + Assert.Multiple(() => + { + Assert.That(runner.CalculationParameters.CalculationModules, Is.Not.Null); + Assert.That(runner.CalculationParameters.MStabParameters, Is.Not.Null); + }); + } - public void AssertNoErrors(DamEngineRunner runner) + public static void AssertNoErrors(DamEngineRunner runner) { if (runner.HasErrors) {