Index: Core/Common/test/Core.Common.TestUtil/TestDataPath.cs
===================================================================
diff -u -rc5a240be9791693799cd7916cb3f2fc6ad0ad65c -r889b379d6fc2e7b41da5d4cbed3f234fab35bdd3
--- Core/Common/test/Core.Common.TestUtil/TestDataPath.cs (.../TestDataPath.cs) (revision c5a240be9791693799cd7916cb3f2fc6ad0ad65c)
+++ Core/Common/test/Core.Common.TestUtil/TestDataPath.cs (.../TestDataPath.cs) (revision 889b379d6fc2e7b41da5d4cbed3f234fab35bdd3)
@@ -140,6 +140,11 @@
{
public static readonly TestDataPath Core = "Riskeer.Storage.Core.Test";
}
+
+ public static class WaveImpactAsphaltCover
+ {
+ public static readonly TestDataPath IO = "Riskeer.WaveImpactAsphaltCover.IO.Test";
+ }
}
}
}
\ No newline at end of file
Index: Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.IO/Configurations/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporter.cs
===================================================================
diff -u
--- Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.IO/Configurations/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporter.cs (revision 0)
+++ Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.IO/Configurations/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporter.cs (revision 889b379d6fc2e7b41da5d4cbed3f234fab35bdd3)
@@ -0,0 +1,54 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU 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.
+//
+// You should have received a copy of the GNU 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;
+using System.Collections.Generic;
+using Riskeer.Common.Data.Calculation;
+using Riskeer.Revetment.IO.Configurations;
+using Riskeer.WaveImpactAsphaltCover.Data;
+
+namespace Riskeer.WaveImpactAsphaltCover.IO.Configurations
+{
+ ///
+ /// Exports a wave impact asphalt cover wave conditions calculation configuration and stores it as an XML file.
+ ///
+ public class WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporter : WaveConditionsCalculationConfigurationExporter<
+ WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter,
+ WaveConditionsCalculationConfiguration,
+ WaveImpactAsphaltCoverWaveConditionsCalculation>
+ {
+ ///
+ ///
+ /// Creates a new instance of .
+ ///
+ /// Thrown when is invalid.
+ public WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporter(IEnumerable calculations, string filePath)
+ : base(calculations, new WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter(filePath)) {}
+
+ protected override WaveConditionsCalculationConfiguration ToConfiguration(
+ WaveImpactAsphaltCoverWaveConditionsCalculation calculation)
+ {
+ var configuration = new AssessmentSectionCategoryWaveConditionsCalculationConfiguration(calculation.Name);
+ SetConfigurationProperties(configuration, calculation);
+ return configuration;
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.IO/Configurations/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter.cs
===================================================================
diff -u
--- Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.IO/Configurations/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter.cs (revision 0)
+++ Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.IO/Configurations/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter.cs (revision 889b379d6fc2e7b41da5d4cbed3f234fab35bdd3)
@@ -0,0 +1,50 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU 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.
+//
+// You should have received a copy of the GNU 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.Xml;
+using Riskeer.Revetment.Data;
+using Riskeer.Revetment.IO.Configurations;
+
+namespace Riskeer.WaveImpactAsphaltCover.IO.Configurations
+{
+ ///
+ /// Writer for calculations that contain as input,
+ /// to XML format.
+ ///
+ public class WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter
+ : WaveConditionsCalculationConfigurationWriter
+ {
+ ///
+ ///
+ /// Creates a new instance of .
+ ///
+ public WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter(string filePath)
+ : base(filePath) {}
+
+ protected override void WriteWaveConditionsSpecificParameters(
+ XmlWriter writer, WaveConditionsCalculationConfiguration configuration) {}
+
+ protected override int GetConfigurationVersion()
+ {
+ return 1;
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.IO/Riskeer.WaveImpactAsphaltCover.IO.csproj
===================================================================
diff -u -r08e8d26a0715f0f3db57c1d3e86256aa06934db4 -r889b379d6fc2e7b41da5d4cbed3f234fab35bdd3
--- Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.IO/Riskeer.WaveImpactAsphaltCover.IO.csproj (.../Riskeer.WaveImpactAsphaltCover.IO.csproj) (revision 08e8d26a0715f0f3db57c1d3e86256aa06934db4)
+++ Riskeer/WaveImpactAsphaltCover/src/Riskeer.WaveImpactAsphaltCover.IO/Riskeer.WaveImpactAsphaltCover.IO.csproj (.../Riskeer.WaveImpactAsphaltCover.IO.csproj) (revision 889b379d6fc2e7b41da5d4cbed3f234fab35bdd3)
@@ -10,11 +10,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
Index: Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/Configurations/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporterTest.cs
===================================================================
diff -u
--- Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/Configurations/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporterTest.cs (revision 0)
+++ Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/Configurations/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporterTest.cs (revision 889b379d6fc2e7b41da5d4cbed3f234fab35bdd3)
@@ -0,0 +1,106 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU 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.
+//
+// You should have received a copy of the GNU 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.Collections.Generic;
+using System.IO;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Riskeer.Common.Data.Calculation;
+using Riskeer.Common.Data.Hydraulics;
+using Riskeer.Common.Data.TestUtil;
+using Riskeer.Common.IO.TestUtil;
+using Riskeer.Revetment.IO.Configurations;
+using Riskeer.WaveImpactAsphaltCover.Data;
+using Riskeer.WaveImpactAsphaltCover.IO.Configurations;
+
+namespace Riskeer.WaveImpactAsphaltCover.IO.Test.Configurations
+{
+ [TestFixture]
+ public class WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporterTest : CustomCalculationConfigurationExporterDesignGuidelinesTestFixture<
+ WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporter,
+ WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter,
+ WaveImpactAsphaltCoverWaveConditionsCalculation,
+ WaveConditionsCalculationConfiguration>
+ {
+ [Test]
+ public void Export_ValidData_ReturnTrueAndWritesFile()
+ {
+ // Setup
+ var calculation1 = new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "Calculation A",
+ InputParameters =
+ {
+ ForeshoreProfile = new TestForeshoreProfile("ForeshoreA")
+ }
+ };
+
+ var calculation2 = new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "PK001_0002 W1-6_4_1D1",
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "HydraulicLocationA", 0, 0),
+ UseBreakWater = true
+ }
+ };
+
+ var calculationGroup2 = new CalculationGroup
+ {
+ Name = "PK001_0002",
+ Children =
+ {
+ calculation2
+ }
+ };
+
+ var calculationGroup = new CalculationGroup
+ {
+ Name = "PK001_0001",
+ Children =
+ {
+ calculation1,
+ calculationGroup2
+ }
+ };
+
+ string expectedXmlFilePath = TestHelper.GetTestDataPath(TestDataPath.Riskeer.WaveImpactAsphaltCover.IO,
+ Path.Combine(
+ nameof(WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporter),
+ "fullValidConfiguration.xml"));
+ // Call & Assert
+ WriteAndValidate(new[]
+ {
+ calculationGroup
+ }, expectedXmlFilePath);
+ }
+
+ protected override WaveImpactAsphaltCoverWaveConditionsCalculation CreateCalculation()
+ {
+ return new WaveImpactAsphaltCoverWaveConditionsCalculation();
+ }
+
+ protected override WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporter CallConfigurationFilePathConstructor(IEnumerable calculations, string filePath)
+ {
+ return new WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporter(calculations, filePath);
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/Configurations/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriterTest.cs
===================================================================
diff -u
--- Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/Configurations/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriterTest.cs (revision 0)
+++ Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/Configurations/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriterTest.cs (revision 889b379d6fc2e7b41da5d4cbed3f234fab35bdd3)
@@ -0,0 +1,129 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU 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.
+//
+// You should have received a copy of the GNU 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 Core.Common.Base.Data;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Riskeer.Common.IO.Configurations;
+using Riskeer.Common.IO.TestUtil;
+using Riskeer.Revetment.IO.Configurations;
+using Riskeer.WaveImpactAsphaltCover.IO.Configurations;
+
+namespace Riskeer.WaveImpactAsphaltCover.IO.Test.Configurations
+{
+ [TestFixture]
+ public class WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriterTest : CustomCalculationConfigurationWriterDesignGuidelinesTestFixture<
+ WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter, WaveConditionsCalculationConfiguration>
+ {
+ [Test]
+ public void Write_SparseCalculation_WritesSparseConfigurationToFile()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath(
+ $"{nameof(Write_SparseCalculation_WritesSparseConfigurationToFile)}.xml");
+
+ string expectedXmlFilePath = TestHelper.GetTestDataPath(
+ TestDataPath.Riskeer.WaveImpactAsphaltCover.IO,
+ Path.Combine(nameof(WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter), "sparseConfiguration.xml"));
+
+ var calculation = new WaveConditionsCalculationConfiguration("Berekening 1");
+
+ try
+ {
+ WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter writer = CreateWriterInstance(filePath);
+
+ // Call
+ writer.Write(new[]
+ {
+ calculation
+ });
+
+ // Assert
+ string actualXml = File.ReadAllText(filePath);
+ string expectedXml = File.ReadAllText(expectedXmlFilePath);
+
+ Assert.AreEqual(expectedXml, actualXml);
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ [Test]
+ public void Write_CompleteCalculation_WritesCompleteConfigurationToFile()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath(
+ $"{nameof(Write_CompleteCalculation_WritesCompleteConfigurationToFile)}.xml");
+
+ string expectedXmlFilePath = TestHelper.GetTestDataPath(
+ TestDataPath.Riskeer.WaveImpactAsphaltCover.IO,
+ Path.Combine(nameof(WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter), "completeConfiguration.xml"));
+
+ var calculation = new WaveConditionsCalculationConfiguration("Berekening 1")
+ {
+ HydraulicBoundaryLocationName = "Locatie1",
+ UpperBoundaryRevetment = (RoundedDouble) 1.5,
+ LowerBoundaryRevetment = (RoundedDouble) 0.5,
+ UpperBoundaryWaterLevels = (RoundedDouble) 1.4,
+ LowerBoundaryWaterLevels = (RoundedDouble) 0.6,
+ StepSize = ConfigurationWaveConditionsInputStepSize.One,
+ ForeshoreProfileId = "profiel1",
+ Orientation = (RoundedDouble) 67.1,
+ WaveReduction = new WaveReductionConfiguration
+ {
+ UseForeshoreProfile = true,
+ UseBreakWater = true,
+ BreakWaterHeight = (RoundedDouble) 1.23,
+ BreakWaterType = ConfigurationBreakWaterType.Dam
+ }
+ };
+
+ try
+ {
+ WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter writer = CreateWriterInstance(filePath);
+
+ // Call
+ writer.Write(new[]
+ {
+ calculation
+ });
+
+ // Assert
+ string actualXml = File.ReadAllText(filePath);
+ string expectedXml = File.ReadAllText(expectedXmlFilePath);
+
+ Assert.AreEqual(expectedXml, actualXml);
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ protected override WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter CreateWriterInstance(string filePath)
+ {
+ return new WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter(filePath);
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/Riskeer.WaveImpactAsphaltCover.IO.Test.csproj
===================================================================
diff -u -r08e8d26a0715f0f3db57c1d3e86256aa06934db4 -r889b379d6fc2e7b41da5d4cbed3f234fab35bdd3
--- Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/Riskeer.WaveImpactAsphaltCover.IO.Test.csproj (.../Riskeer.WaveImpactAsphaltCover.IO.Test.csproj) (revision 08e8d26a0715f0f3db57c1d3e86256aa06934db4)
+++ Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/Riskeer.WaveImpactAsphaltCover.IO.Test.csproj (.../Riskeer.WaveImpactAsphaltCover.IO.Test.csproj) (revision 889b379d6fc2e7b41da5d4cbed3f234fab35bdd3)
@@ -10,15 +10,16 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
Index: Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporter/fullValidConfiguration.xml
===================================================================
diff -u
--- Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporter/fullValidConfiguration.xml (revision 0)
+++ Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationExporter/fullValidConfiguration.xml (revision 889b379d6fc2e7b41da5d4cbed3f234fab35bdd3)
@@ -0,0 +1,31 @@
+
+
+
+
\ No newline at end of file
Index: Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter/completeConfiguration.xml
===================================================================
diff -u
--- Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter/completeConfiguration.xml (revision 0)
+++ Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter/completeConfiguration.xml (revision 889b379d6fc2e7b41da5d4cbed3f234fab35bdd3)
@@ -0,0 +1,19 @@
+
+
+
+ Locatie1
+ 1.5
+ 0.5
+ 1.4
+ 0.6
+ 1.0
+ profiel1
+ 67.1
+
+ true
+ havendam
+ 1.23
+ true
+
+
+
\ No newline at end of file
Index: Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter/sparseConfiguration.xml
===================================================================
diff -u
--- Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter/sparseConfiguration.xml (revision 0)
+++ Riskeer/WaveImpactAsphaltCover/test/Riskeer.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverWaveConditionsCalculationConfigurationWriter/sparseConfiguration.xml (revision 889b379d6fc2e7b41da5d4cbed3f234fab35bdd3)
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file