Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/TestFiles/Operational/Profile2DTests/CalculateStabilityInside2DOutput.xml =================================================================== diff -u Binary files differ Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/Deltares.DamEngine.IntegrationTests.csproj =================================================================== diff -u -r5861 -r5865 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/Deltares.DamEngine.IntegrationTests.csproj (.../Deltares.DamEngine.IntegrationTests.csproj) (revision 5861) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/Deltares.DamEngine.IntegrationTests.csproj (.../Deltares.DamEngine.IntegrationTests.csproj) (revision 5865) @@ -215,6 +215,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + PreserveNewest Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/TestFiles/Operational/Profile2DTests/CalculateStabilityInside2DInput.xml =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/TestFiles/Operational/Profile2DTests/CalculateStabilityInside2DInput.xml (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/TestFiles/Operational/Profile2DTests/CalculateStabilityInside2DInput.xml (revision 5865) @@ -0,0 +1,714 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalStabilityProfile2DTests.cs =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalStabilityProfile2DTests.cs (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/OperationalStabilityProfile2DTests.cs (revision 5865) @@ -0,0 +1,85 @@ +// Copyright (C) Stichting Deltares 2024. All rights reserved. +// +// This file is part of the Dam Engine. +// +// The Dam Engine 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 Affero General Public License for more details. +// +// 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 +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.IO; +using System.Linq; +using Deltares.DamEngine.Io; +using Deltares.DamEngine.Io.XmlOutput; +using Deltares.DamEngine.TestHelpers; +using KellermanSoftware.CompareNetObjects; +using NUnit.Framework; + +namespace Deltares.DamEngine.IntegrationTests.IntegrationTests; + +[TestFixture] +public class OperationalStabilityProfile2DTests +{ + /// + /// The following test is based on the DamLive test Deltares.DamLive.Tests.StabilityInside2DTest + /// + [Test] + public void GivenStabilityInsideProfile2DProject_WhenCalculating_ThenExpectedResultIsGenerated() + { + const string calcDir = "DAMLive.Calc"; + const string testFilesLocation = @".\TestFiles\Operational\Profile2DTests\"; + const string baseOutputName = "CalculateStabilityInside2D"; + const string inputFilename = baseOutputName + "Input.xml"; + const string outputFilename = baseOutputName + "Output.xml"; + if (Directory.Exists(calcDir)) + { + Directory.Delete(calcDir, true); // delete previous results + } + + const string expectedOutputFileName = testFilesLocation + outputFilename; + Output expectedOutput = DamXmlSerialization.LoadOutputFromXmlFile(expectedOutputFileName); + + // Given + string inputString = File.ReadAllText(testFilesLocation + inputFilename); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", baseOutputName); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + + // When + Output actualOutput = GeneralHelper.RunAfterInputValidation(inputString, true, outputFilename); + + // Then + Assert.Multiple(() => + { + Assert.That(actualOutput, Is.Not.Null); + Assert.That(expectedOutput, Is.Not.Null); + } + ); + Assert.That(actualOutput.Results.CalculationMessages.Any(message => message.MessageType == MessageMessageType.Error), Is.False, "No errors should occur during the calculation"); + CompareOutput(expectedOutput, actualOutput); + } + + private static void CompareOutput(Output expected, Output actual) + { + var compare = new CompareLogic + { + Config = + { + MaxDifferences = 100 + } + }; + ComparisonResult result = compare.Compare(expected, actual); + Assert.That(result.Differences, Is.Empty, "Differences found read/write Output object"); + } +} \ No newline at end of file