// Copyright (C) Stichting Deltares 2019. 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.Threading; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Interface; using Deltares.DamEngine.Io; using NUnit.Framework; namespace Deltares.DamEngine.IntegrationTests.IntegrationTests { [TestFixture] public class DebuggingTest { private const string mapTestFiles = @"TestFiles\"; /// Debugs the with XML input file. /// Usage: /// 1) Generate the input XML file in the DAM UI /// 2) Copy the file to src\Deltares.DamEngine.IntegrationTests\TestFiles\InputForDebugging.xml /// 3) Run the test in Debugging mode /// [Test, Ignore("This test is only used for debugging XML files generated by Dam UI")] public void DebugWithXmlInputFile() { const string inputFilename = "InputForDebugging.xml"; string fullInputFilename = Path.Combine(mapTestFiles, inputFilename); Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; string inputString = File.ReadAllText(fullInputFilename); EngineInterface engineInterface = new EngineInterface(inputString); Assert.IsNotNull(engineInterface.DamProjectData); var result = engineInterface.Validate(); Assert.IsTrue(result == null, "Validation must succeed but does not, see output xml in debugger"); string outputString = engineInterface.Run(); var output = DamXmlSerialization.LoadOutputFromXmlString(outputString); if (engineInterface.DamProjectData.DamProjectType == DamProjectType.Design) { Assert.AreNotEqual(null, output.Results.CalculationResults); } else { Assert.AreNotEqual(null, output.Results.OperationalOutputTimeSeries); } } } }