Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveHHNKTests.cs =================================================================== diff -u -r6114 -r7134 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveHHNKTests.cs (.../DamLiveHHNKTests.cs) (revision 6114) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveHHNKTests.cs (.../DamLiveHHNKTests.cs) (revision 7134) @@ -22,8 +22,8 @@ using System; using System.Collections.Generic; using System.Linq; -using Deltares.DamLive.Application; using Deltares.Dam.Data; +using Deltares.DamLive.Application; using Deltares.DamLive.TestHelper; using NUnit.Framework; @@ -34,7 +34,7 @@ public class DamLiveHHNKTests { private const double cTolerance = 0.0005; - + [Test] [Category("Integration")] public void CalculateStability2DUpliftVanUsingTestFilesHasExpectedResultsInOutputFile() @@ -65,17 +65,20 @@ Assert.That(firstEntry.Value, Is.EqualTo(0.932).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.NaN, "Expected NaN due to no uplift"); isLastResultFound = true; } + seriesCount++; } + Assert.Multiple(() => { - Assert.That(seriesCount, Is.EqualTo(8)); + 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"); }); @@ -97,10 +100,9 @@ private void SetupStabilityProject() { IoHelper.RemoveTestWorkingDirectory(testWorkingFolder); // to be sure no test directory exist from previous tests - GeneralHelper.SetupIntegrationProject(testWorkingFolder, testStabilityDataFolder, projectStabilityFilename, - out runner, out locations); + GeneralHelper.SetupIntegrationProject(testWorkingFolder, testStabilityDataFolder, projectStabilityFilename, + out runner, out locations); } #endregion - } \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/License/LicenseTest.cs =================================================================== diff -u -r5051 -r7134 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/License/LicenseTest.cs (.../LicenseTest.cs) (revision 5051) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/License/LicenseTest.cs (.../LicenseTest.cs) (revision 7134) @@ -1,18 +1,18 @@ -// Copyright (C) Stichting Deltares 2024. All rights reserved. +// Copyright (C) Stichting Deltares 2023. All rights reserved. // -// This file is part of the application DAM - UI. +// This file is part of the application DAM - Live. // -// DAM - UI is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by +// DAM - Live is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of @@ -40,7 +40,7 @@ DamLicense.CheckinLicense(); } - + [Test] public void GivenUnlicensedVersionWhenCheckingOutThenReturnsNoLicense() { Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Application/Program.cs =================================================================== diff -u -r5844 -r7134 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Application/Program.cs (.../Program.cs) (revision 5844) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Application/Program.cs (.../Program.cs) (revision 7134) @@ -35,7 +35,7 @@ internal static readonly LogHelper Logger = LogHelper.Create("DamLive"); private const string dAuthFeature = "DGS_27_00"; - static readonly AssemblyInfoHelper info = new AssemblyInfoHelper(typeof(Program)); + private static readonly AssemblyInfoHelper info = new AssemblyInfoHelper(typeof(Program)); /// /// Starts the calculations. @@ -107,7 +107,7 @@ damEngineRunner.Run(); } - static void Main(string[] args) + private static void Main(string[] args) { DamLicense.CheckoutLicense(dAuthFeature, info.AssemblyVersion); @@ -130,7 +130,7 @@ DamLicense.CheckinLicense(); } - static void Run(string[] args) + private static void Run(string[] args) { var commandLineArguments = new CommandOptions(); ICommandLineParser parser = new CommandLineParser(); Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Application/XmlConversionHelper.cs =================================================================== diff -u -r6263 -r7134 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Application/XmlConversionHelper.cs (.../XmlConversionHelper.cs) (revision 6263) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Application/XmlConversionHelper.cs (.../XmlConversionHelper.cs) (revision 7134) @@ -22,6 +22,7 @@ using System.Collections.Generic; using Deltares.Dam.Data; using Deltares.DamLive.Io; +using StabilitySearchMethod = Deltares.Dam.Data.StabilitySearchMethod; namespace Deltares.DamLive.Application; @@ -43,7 +44,7 @@ }; return translationTable[model]; } - + public static StabilityCalculationModel ConvertToModelType(StabilityModelType model) { var translationTable = new Dictionary @@ -60,30 +61,30 @@ }; return translationTable[model]; } - - public static Deltares.Dam.Data.StabilitySearchMethod ConvertToSearchMethod(Io.StabilitySearchMethod model) + + public static StabilitySearchMethod ConvertToSearchMethod(Io.StabilitySearchMethod model) { - var translationTable = new Dictionary + var translationTable = new Dictionary { { - Io.StabilitySearchMethod.Grid, Dam.Data.StabilitySearchMethod.Grid + Io.StabilitySearchMethod.Grid, StabilitySearchMethod.Grid }, { - Io.StabilitySearchMethod.BeeSwarm, Dam.Data.StabilitySearchMethod.BeeSwarm + Io.StabilitySearchMethod.BeeSwarm, StabilitySearchMethod.BeeSwarm } }; return translationTable[model]; } - - public static Io.StabilitySearchMethod ConvertToSearchMethod(Deltares.Dam.Data.StabilitySearchMethod model) + + public static Io.StabilitySearchMethod ConvertToSearchMethod(StabilitySearchMethod model) { - var translationTable = new Dictionary + var translationTable = new Dictionary { { - Dam.Data.StabilitySearchMethod.Grid, Io.StabilitySearchMethod.Grid + StabilitySearchMethod.Grid, Io.StabilitySearchMethod.Grid }, { - Dam.Data.StabilitySearchMethod.BeeSwarm, Io.StabilitySearchMethod.BeeSwarm + StabilitySearchMethod.BeeSwarm, Io.StabilitySearchMethod.BeeSwarm } }; return translationTable[model]; Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/FillDomainFromXmlCalculationParametersTests.cs =================================================================== diff -u -r6978 -r7134 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/FillDomainFromXmlCalculationParametersTests.cs (.../FillDomainFromXmlCalculationParametersTests.cs) (revision 6978) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/FillDomainFromXmlCalculationParametersTests.cs (.../FillDomainFromXmlCalculationParametersTests.cs) (revision 7134) @@ -19,8 +19,8 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using Deltares.DamLive.Application; using Deltares.Dam.Data; +using Deltares.DamLive.Application; using Deltares.DamLive.Io; using KellermanSoftware.CompareNetObjects; using NUnit.Framework; @@ -52,7 +52,7 @@ CompareCalculationParametersData(actualData, expectedData); } - private static DamProjectCalculationSpecification CreateExampleCalculationParameters(FailureMechanismSystemType mechanismType, + private static DamProjectCalculationSpecification CreateExampleCalculationParameters(FailureMechanismSystemType mechanismType, PipingModelType pipingModel, StabilityModelType stabModel, StabilitySearchMethod searchMethod) { var calculationSpecification = new DamProjectCalculationSpecification @@ -65,7 +65,7 @@ return calculationSpecification; } - private static void CompareCalculationParametersData(DamProjectCalculationSpecification actual, + private static void CompareCalculationParametersData(DamProjectCalculationSpecification actual, DamProjectCalculationSpecification expected) { var compare = new CompareLogic Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Io/CalculationParametersXmlSerialization.cs =================================================================== diff -u -r5807 -r7134 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Io/CalculationParametersXmlSerialization.cs (.../CalculationParametersXmlSerialization.cs) (revision 5807) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Io/CalculationParametersXmlSerialization.cs (.../CalculationParametersXmlSerialization.cs) (revision 7134) @@ -32,7 +32,7 @@ var xmlSerializer = new XmlSerializer(typeof(XmlCalculationParameters)); var reader = new StringReader(calculationParametersXml); var calculationParameters = (XmlCalculationParameters) xmlSerializer.Deserialize(reader); - return calculationParameters; + return calculationParameters; } public static void SaveAsXmlFile(string filename, XmlCalculationParameters calculationParameters) Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Application/CommandOptions.cs =================================================================== diff -u -r5844 -r7134 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Application/CommandOptions.cs (.../CommandOptions.cs) (revision 5844) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Application/CommandOptions.cs (.../CommandOptions.cs) (revision 7134) @@ -68,7 +68,7 @@ private AssemblyInfoHelper ThisAssembly { get; } = new AssemblyInfoHelper(typeof(Program)); - void HandleParsingErrorsInHelp(HelpText help) + private void HandleParsingErrorsInHelp(HelpText help) { if (LastPostParsingState.Errors.Count > 0) { Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanGridTest.cs =================================================================== diff -u -r6953 -r7134 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanGridTest.cs (.../StabilityInsideUpliftVanGridTest.cs) (revision 6953) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanGridTest.cs (.../StabilityInsideUpliftVanGridTest.cs) (revision 7134) @@ -22,8 +22,8 @@ using System; using System.Collections.Generic; using System.Linq; -using Deltares.DamLive.Application; using Deltares.Dam.Data; +using Deltares.DamLive.Application; using Deltares.DamLive.TestHelper; using NUnit.Framework; @@ -74,11 +74,8 @@ runner.Initialize(); runner.MaxCalculationCores = maxCores; Assert.That(runner, Is.Not.Null); - Assert.Multiple(() => - { - Assert.That(runner.DamProjectData, Is.Not.Null); - }); - + Assert.Multiple(() => { Assert.That(runner.DamProjectData, Is.Not.Null); }); + runner.Run(); runner.OutputTimeSeriesCollection.Save("StabilityInsideUpliftVanOutputFile" + maxCores + ".xml"); Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/PipingWtiInsideTest.cs =================================================================== diff -u -r6953 -r7134 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/PipingWtiInsideTest.cs (.../PipingWtiInsideTest.cs) (revision 6953) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/PipingWtiInsideTest.cs (.../PipingWtiInsideTest.cs) (revision 7134) @@ -22,8 +22,8 @@ using System; using System.Collections.Generic; using System.Linq; -using Deltares.DamLive.Application; using Deltares.Dam.Data; +using Deltares.DamLive.Application; using Deltares.DamLive.TestHelper; using NUnit.Framework; @@ -41,10 +41,10 @@ private const string testWorkingFolder = @".\damLivePipingWtiWork"; private const string testIntegrationDataFolder = @"..\..\TestData\IntegrationTests\PipingWti"; private List locations; - + private DamEngineRunner runner; private int maxCores; - + [SetUp] public void SetupFixture() { @@ -53,32 +53,29 @@ IoHelper.RemoveTestWorkingDirectory(testWorkingFolder + maxCores); } + [SetUp] + public void SetupTest() {} + [TearDown] public void TearDownFixture() { IoHelper.RemoveTestWorkingDirectory(testWorkingFolder + maxCores); } - [SetUp] - public void SetupTest() {} - [Test] [Category("Integration")] public void CalculatePipingInsideWt1ModelUsingTestFilesHasExpectedResultsInOutputFile() { const double cTolerance = 0.0005; string testFileName = "CalculatePipingInsideWt1Model" + maxCores; - GeneralHelper.SetupIntegrationProject(maxCores, testWorkingFolder, testIntegrationDataFolder, input1AFilename, - output1AFilename, testFileName, calculationParametersIntegrationFilename, + GeneralHelper.SetupIntegrationProject(maxCores, testWorkingFolder, testIntegrationDataFolder, input1AFilename, + output1AFilename, testFileName, calculationParametersIntegrationFilename, projectIntegrationFilename, out runner, out locations); runner.Initialize(); runner.MaxCalculationCores = maxCores; Assert.That(runner, Is.Not.Null); - Assert.Multiple(() => - { - Assert.That(runner.DamProjectData, Is.Not.Null); - }); - + Assert.Multiple(() => { Assert.That(runner.DamProjectData, Is.Not.Null); }); + runner.Run(); runner.OutputTimeSeriesCollection.Save("WtiPipingOutputFile" + maxCores + ".xml"); @@ -137,5 +134,4 @@ Assert.That(resultsCount, Is.EqualTo(16), "Incorrect number of results"); }); } - } \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/XmlConversionHelperTests.cs =================================================================== diff -u -r6263 -r7134 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/XmlConversionHelperTests.cs (.../XmlConversionHelperTests.cs) (revision 6263) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/XmlConversionHelperTests.cs (.../XmlConversionHelperTests.cs) (revision 7134) @@ -19,8 +19,8 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using Deltares.DamLive.Application; using Deltares.Dam.Data; +using Deltares.DamLive.Application; using Deltares.DamLive.Io; using NUnit.Framework; using StabilitySearchMethod = Deltares.DamLive.Io.StabilitySearchMethod; @@ -31,21 +31,21 @@ public class XmlConversionHelperTests { [Test] - [TestCase(StabilitySearchMethod.Grid, Deltares.Dam.Data.StabilitySearchMethod.Grid)] - [TestCase(StabilitySearchMethod.BeeSwarm, Deltares.Dam.Data.StabilitySearchMethod.BeeSwarm)] - public void CanConvertToDataSearchMethodType(StabilitySearchMethod xmlType, Deltares.Dam.Data.StabilitySearchMethod dataType) + [TestCase(StabilitySearchMethod.Grid, Dam.Data.StabilitySearchMethod.Grid)] + [TestCase(StabilitySearchMethod.BeeSwarm, Dam.Data.StabilitySearchMethod.BeeSwarm)] + public void CanConvertToDataSearchMethodType(StabilitySearchMethod xmlType, Dam.Data.StabilitySearchMethod dataType) { Assert.That(XmlConversionHelper.ConvertToSearchMethod(xmlType), Is.EqualTo(dataType)); } [Test] - [TestCase(Deltares.Dam.Data.StabilitySearchMethod.Grid, StabilitySearchMethod.Grid)] - [TestCase(Deltares.Dam.Data.StabilitySearchMethod.BeeSwarm, StabilitySearchMethod.BeeSwarm)] - public void CanConvertToXmlSearchMethodType(Deltares.Dam.Data.StabilitySearchMethod dataType, StabilitySearchMethod xmlType) + [TestCase(Dam.Data.StabilitySearchMethod.Grid, StabilitySearchMethod.Grid)] + [TestCase(Dam.Data.StabilitySearchMethod.BeeSwarm, StabilitySearchMethod.BeeSwarm)] + public void CanConvertToXmlSearchMethodType(Dam.Data.StabilitySearchMethod dataType, StabilitySearchMethod xmlType) { Assert.That(XmlConversionHelper.ConvertToSearchMethod(dataType), Is.EqualTo(xmlType)); } - + [Test] [TestCase(StabilityCalculationModel.Bishop, StabilityModelType.Bishop)] [TestCase(StabilityCalculationModel.UpliftVan, StabilityModelType.UpliftVan)] @@ -54,11 +54,11 @@ { Assert.That(XmlConversionHelper.ConvertToModelType(xmlType), Is.EqualTo(dataType)); } - + [Test] - [TestCase( StabilityModelType.Bishop, StabilityCalculationModel.Bishop)] - [TestCase( StabilityModelType.UpliftVan, StabilityCalculationModel.UpliftVan)] - [TestCase( StabilityModelType.BishopUpliftVan, StabilityCalculationModel.BishopUpliftVan)] + [TestCase(StabilityModelType.Bishop, StabilityCalculationModel.Bishop)] + [TestCase(StabilityModelType.UpliftVan, StabilityCalculationModel.UpliftVan)] + [TestCase(StabilityModelType.BishopUpliftVan, StabilityCalculationModel.BishopUpliftVan)] public void CanConvertToXmlModelType(StabilityModelType dataType, StabilityCalculationModel xmlType) { Assert.That(XmlConversionHelper.ConvertToModelType(dataType), Is.EqualTo(xmlType)); Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/GeneralHelper.cs =================================================================== diff -u -r6953 -r7134 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/GeneralHelper.cs (.../GeneralHelper.cs) (revision 6953) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/GeneralHelper.cs (.../GeneralHelper.cs) (revision 7134) @@ -23,8 +23,8 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using Deltares.DamLive.Application; using Deltares.Dam.Data; +using Deltares.DamLive.Application; using Deltares.Standard.IO; using NUnit.Framework; @@ -44,6 +44,7 @@ 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) @@ -54,7 +55,8 @@ SetupIntegrationProject("", testWorkingFolder, testIntegrationDataFolder, inputFilename, outputFilename, "test", parametersFilename, projectIntegrationFilename, out runner, out locations); } - public static void SetupIntegrationProject(string postfix, string testWorkingFolder, string testIntegrationDataFolder, + + 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) @@ -96,20 +98,17 @@ runner.Initialize(); runner.DamProjectData.MaxCalculationCores = maxCores; Assert.That(runner, Is.Not.Null); - Assert.Multiple(() => - { - Assert.That(runner.DamProjectData, Is.Not.Null); - }); + Assert.Multiple(() => { Assert.That(runner.DamProjectData, Is.Not.Null); }); } - + public static void AssertNoErrors(DamEngineRunner runner) { if (runner.HasErrors) { Assert.Fail("The test failed. See the error log in the test output console for more info"); } } - + /// /// Make timeserie shorter for testing: the first, the last and the middle entry are only used /// @@ -119,7 +118,7 @@ if (inputTimeSeries?.Series[0] != null && inputTimeSeries.Series[0].Entries.Count > 3) { double entriesCount = inputTimeSeries.Series[0].Entries.Count; - var middleIndex = (int)Math.Round(entriesCount / 2); + var middleIndex = (int) Math.Round(entriesCount / 2); foreach (TimeSerie serie in inputTimeSeries.Series) { for (int i = serie.Entries.Count - 2; i > 0; i--) @@ -132,5 +131,4 @@ } } } - } \ No newline at end of file