Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.IO/Exporters/GrassCoverErosionOutwardsCalculationConfigurationExporter.cs
===================================================================
diff -u -rfcd32c8e949b4581cc20adcaa7cf7639fcb69d20 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.IO/Exporters/GrassCoverErosionOutwardsCalculationConfigurationExporter.cs (.../GrassCoverErosionOutwardsCalculationConfigurationExporter.cs) (revision fcd32c8e949b4581cc20adcaa7cf7639fcb69d20)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.IO/Exporters/GrassCoverErosionOutwardsCalculationConfigurationExporter.cs (.../GrassCoverErosionOutwardsCalculationConfigurationExporter.cs) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -24,15 +24,17 @@
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.IO.Configurations.Export;
using Ringtoets.GrassCoverErosionOutwards.Data;
-using Ringtoets.GrassCoverErosionOutwards.IO.Writers;
+using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.IO.Configurations;
+using Ringtoets.Revetment.IO.Configurations.Helpers;
namespace Ringtoets.GrassCoverErosionOutwards.IO.Exporters
{
///
/// Exports a grass cover erosion outwards calculation configuration and stores it as an XML file.
///
public class GrassCoverErosionOutwardsCalculationConfigurationExporter
- : CalculationConfigurationExporter
+ : SchemaCalculationConfigurationExporter
{
///
/// Creates a new instance of .
@@ -43,5 +45,15 @@
/// Thrown when is invalid.
public GrassCoverErosionOutwardsCalculationConfigurationExporter(IEnumerable configuration, string filePath)
: base(configuration, filePath) {}
+
+ protected override WaveConditionsCalculationConfigurationWriter CreateWriter(string filePath)
+ {
+ return new WaveConditionsCalculationConfigurationWriter(filePath);
+ }
+
+ protected override WaveConditionsCalculationConfiguration ToConfiguration(GrassCoverErosionOutwardsWaveConditionsCalculation calculation)
+ {
+ return calculation.InputParameters.ToConfiguration(calculation.Name);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.IO/Ringtoets.GrassCoverErosionOutwards.IO.csproj
===================================================================
diff -u -r8aeff3f1153aaac2b2980ca207e298b6d764947b -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.IO/Ringtoets.GrassCoverErosionOutwards.IO.csproj (.../Ringtoets.GrassCoverErosionOutwards.IO.csproj) (revision 8aeff3f1153aaac2b2980ca207e298b6d764947b)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.IO/Ringtoets.GrassCoverErosionOutwards.IO.csproj (.../Ringtoets.GrassCoverErosionOutwards.IO.csproj) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -41,7 +41,6 @@
Properties\GlobalAssembly.cs
-
Fisheye: Tag 4fa75e2c07753d69a156377821eec5caaff7fc11 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.IO/Writers/GrassCoverErosionOutwardsCalculationConfigurationWriter.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/Exporters/GrassCoverErosionOutwardsCalculationConfigurationExporterTest.cs
===================================================================
diff -u -rfcd32c8e949b4581cc20adcaa7cf7639fcb69d20 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/Exporters/GrassCoverErosionOutwardsCalculationConfigurationExporterTest.cs (.../GrassCoverErosionOutwardsCalculationConfigurationExporterTest.cs) (revision fcd32c8e949b4581cc20adcaa7cf7639fcb69d20)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/Exporters/GrassCoverErosionOutwardsCalculationConfigurationExporterTest.cs (.../GrassCoverErosionOutwardsCalculationConfigurationExporterTest.cs) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -19,6 +19,7 @@
// 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;
@@ -28,16 +29,17 @@
using Ringtoets.Common.IO.TestUtil;
using Ringtoets.GrassCoverErosionOutwards.Data;
using Ringtoets.GrassCoverErosionOutwards.IO.Exporters;
-using Ringtoets.GrassCoverErosionOutwards.IO.Writers;
+using Ringtoets.Revetment.IO.Configurations;
namespace Ringtoets.GrassCoverErosionOutwards.IO.Test.Exporters
{
[TestFixture]
public class GrassCoverErosionOutwardsCalculationConfigurationExporterTest
- : CustomCalculationConfigurationExporterDesignGuidelinesTestFixture<
+ : CustomSchemaCalculationConfigurationExporterDesignGuidelinesTestFixture<
GrassCoverErosionOutwardsCalculationConfigurationExporter,
- GrassCoverErosionOutwardsCalculationConfigurationWriter,
- GrassCoverErosionOutwardsWaveConditionsCalculation>
+ WaveConditionsCalculationConfigurationWriter,
+ GrassCoverErosionOutwardsWaveConditionsCalculation,
+ WaveConditionsCalculationConfiguration>
{
[Test]
public void Export_ValidData_ReturnTrueAndWritesFile()
@@ -94,5 +96,10 @@
{
return new GrassCoverErosionOutwardsWaveConditionsCalculation();
}
+
+ protected override GrassCoverErosionOutwardsCalculationConfigurationExporter CallConfigurationFilePathConstructor(IEnumerable calculations, string filePath)
+ {
+ return new GrassCoverErosionOutwardsCalculationConfigurationExporter(calculations, filePath);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/Ringtoets.GrassCoverErosionOutwards.IO.Test.csproj
===================================================================
diff -u -r8aeff3f1153aaac2b2980ca207e298b6d764947b -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/Ringtoets.GrassCoverErosionOutwards.IO.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.IO.Test.csproj) (revision 8aeff3f1153aaac2b2980ca207e298b6d764947b)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/Ringtoets.GrassCoverErosionOutwards.IO.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.IO.Test.csproj) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -50,7 +50,6 @@
Properties\GlobalAssembly.cs
-
Fisheye: Tag 4fa75e2c07753d69a156377821eec5caaff7fc11 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/Writers/GrassCoverErosionOutwardsCalculationConfigurationWriterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/Helpers/WaveConditionsInputExtensions.cs
===================================================================
diff -u
--- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/Helpers/WaveConditionsInputExtensions.cs (revision 0)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/Helpers/WaveConditionsInputExtensions.cs (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -0,0 +1,60 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets 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 Ringtoets.Revetment.Data;
+
+namespace Ringtoets.Revetment.IO.Configurations.Helpers
+{
+ ///
+ /// Extension methods for converting to .
+ ///
+ public static class WaveConditionsInputExtensions
+ {
+ ///
+ /// Converts a to .
+ ///
+ /// The input to convert.
+ /// The name to use for the resulting configuration.
+ /// A new with values
+ /// taken from .
+ /// Thrown when any parameter is null.
+ public static WaveConditionsCalculationConfiguration ToConfiguration(this WaveConditionsInput input, string calculationName)
+ {
+ if (input == null)
+ {
+ throw new ArgumentNullException(nameof(input));
+ }
+ var calculationConfiguration = new WaveConditionsCalculationConfiguration(calculationName)
+ {
+ HydraulicBoundaryLocation = input.HydraulicBoundaryLocation?.Name,
+ LowerBoundaryRevetment = input.LowerBoundaryRevetment,
+ UpperBoundaryRevetment = input.UpperBoundaryRevetment,
+ LowerBoundaryWaterLevels = input.LowerBoundaryWaterLevels,
+ UpperBoundaryWaterLevels = input.UpperBoundaryWaterLevels,
+ Orientation = input.Orientation,
+ StepSize = (ConfigurationWaveConditionsInputStepSize?) new ConfigurationWaveConditionsInputStepSizeConverter().ConvertFrom(input.StepSize)
+ };
+ calculationConfiguration.SetConfigurationForeshoreProfileDependendProperties(input);
+ return calculationConfiguration;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/Helpers/WaveReductionConversionExtensions.cs
===================================================================
diff -u
--- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/Helpers/WaveReductionConversionExtensions.cs (revision 0)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/Helpers/WaveReductionConversionExtensions.cs (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -0,0 +1,74 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets 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 Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.IO.Configurations;
+using Ringtoets.Common.IO.Configurations.Helpers;
+using Ringtoets.Revetment.Data;
+
+namespace Ringtoets.Revetment.IO.Configurations.Helpers
+{
+ ///
+ /// Extension methods for setting wave reduction properties of configuration elements.
+ ///
+ public static class WaveReductionConversionExtensions
+ {
+ ///
+ /// Sets the using properties from ,
+ /// when is set.
+ ///
+ /// The configuration to update.
+ /// The wave conditions input to update from.
+ /// Thrown when any of the input parameters is null.
+ public static void SetConfigurationForeshoreProfileDependendProperties(this WaveConditionsCalculationConfiguration configuration,
+ WaveConditionsInput input)
+ {
+ if (configuration == null)
+ {
+ throw new ArgumentNullException(nameof(configuration));
+ }
+ if (input == null)
+ {
+ throw new ArgumentNullException(nameof(input));
+ }
+
+ if (input.ForeshoreProfile == null)
+ {
+ return;
+ }
+
+ configuration.ForeshoreProfile = input.ForeshoreProfile?.Id;
+ configuration.WaveReduction = new WaveReductionConfiguration
+ {
+ UseForeshoreProfile = input.UseForeshore,
+ UseBreakWater = input.UseBreakWater,
+ BreakWaterHeight = input.BreakWater.Height
+ };
+
+ if (Enum.IsDefined(typeof(BreakWaterType), input.BreakWater.Type))
+ {
+ configuration.WaveReduction.BreakWaterType = (ConfigurationBreakWaterType?)
+ new ConfigurationBreakWaterTypeConverter().ConvertFrom(input.BreakWater.Type);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfiguration.cs
===================================================================
diff -u -r4274bc4f40504c659612e15175dc635fc6e5bba9 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfiguration.cs (.../WaveConditionsCalculationConfiguration.cs) (revision 4274bc4f40504c659612e15175dc635fc6e5bba9)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfiguration.cs (.../WaveConditionsCalculationConfiguration.cs) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -82,26 +82,11 @@
public double? Orientation { get; set; }
///
- /// Gets whether the breakwater should be used for the read calculation.
+ /// Gets or sets the wave reduction configuration.
///
- public bool? UseBreakWater { get; set; }
+ public WaveReductionConfiguration WaveReduction { get; set; }
///
- /// Gets the breakwater type of the read calculation.
- ///
- public ConfigurationBreakWaterType? BreakWaterType { get; set; }
-
- ///
- /// Gets the breakwater height of the read calculation.
- ///
- public double? BreakWaterHeight { get; set; }
-
- ///
- /// Gets whether the foreshore should be used for the read calculation.
- ///
- public bool? UseForeshore { get; set; }
-
- ///
/// Gets or sets the name of the .
///
/// Thrown when is null.
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfigurationImporter.cs
===================================================================
diff -u -r2057d3372084602a2d959db2e33dcf81de971a73 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfigurationImporter.cs (.../WaveConditionsCalculationConfigurationImporter.cs) (revision 2057d3372084602a2d959db2e33dcf81de971a73)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfigurationImporter.cs (.../WaveConditionsCalculationConfigurationImporter.cs) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -93,8 +93,10 @@
&& TryReadBoundaries(calculationConfiguration, waveConditionsCalculation)
&& TryReadForeshoreProfile(calculationConfiguration.ForeshoreProfile, waveConditionsCalculation)
&& TryReadOrientation(calculationConfiguration, waveConditionsCalculation)
- && TryReadWaveReduction(calculationConfiguration, waveConditionsCalculation))
+ && calculationConfiguration.WaveReduction.ValidateWaveReduction(waveConditionsCalculation.InputParameters.ForeshoreProfile,
+ waveConditionsCalculation.Name, Log))
{
+ SetWaveReductionParameters(calculationConfiguration.WaveReduction, waveConditionsCalculation.InputParameters);
return waveConditionsCalculation;
}
return null;
@@ -209,76 +211,5 @@
}
return true;
}
-
- ///
- /// Reads the wave reduction parameters.
- ///
- /// The calculation read from the imported file.
- /// The calculation to configure.
- /// false when there is an invalid wave reduction parameter defined,
- /// true otherwise.
- private bool TryReadWaveReduction(WaveConditionsCalculationConfiguration calculationConfiguration, ICalculation calculation)
- {
- if (!ValidateWaveReduction(calculationConfiguration, calculation))
- {
- return false;
- }
-
- if (calculationConfiguration.UseForeshore.HasValue)
- {
- calculation.InputParameters.UseForeshore = calculationConfiguration.UseForeshore.Value;
- }
-
- if (calculationConfiguration.UseBreakWater.HasValue)
- {
- calculation.InputParameters.UseBreakWater = calculationConfiguration.UseBreakWater.Value;
- }
-
- if (calculationConfiguration.BreakWaterType.HasValue)
- {
- calculation.InputParameters.BreakWater.Type = (BreakWaterType) calculationConfiguration.BreakWaterType.Value;
- }
-
- if (calculationConfiguration.BreakWaterHeight.HasValue)
- {
- calculation.InputParameters.BreakWater.Height = (RoundedDouble) calculationConfiguration.BreakWaterHeight.Value;
- }
- return true;
- }
-
- ///
- /// Validation to check if the defined wave reduction parameters are valid.
- ///
- /// The calculation read from the imported file.
- /// The calculation to configure.
- /// false when there is an invalid wave reduction parameter defined,
- /// true otherwise.
- private bool ValidateWaveReduction(WaveConditionsCalculationConfiguration calculationConfiguration, ICalculation calculation)
- {
- if (calculation.InputParameters.ForeshoreProfile == null)
- {
- if (calculationConfiguration.UseBreakWater.HasValue
- || calculationConfiguration.UseForeshore.HasValue
- || calculationConfiguration.BreakWaterHeight != null
- || calculationConfiguration.BreakWaterType != null)
- {
- Log.LogCalculationConversionError(RingtoetsCommonIOResources.CalculationConfigurationImporter_ValidateWaveReduction_No_foreshore_profile_provided,
- calculation.Name);
- return false;
- }
- }
- else if (!calculation.InputParameters.ForeshoreGeometry.Any())
- {
- if (calculationConfiguration.UseForeshore.HasValue && calculationConfiguration.UseForeshore.Value)
- {
- Log.LogCalculationConversionError(string.Format(
- RingtoetsCommonIOResources.ReadForeshoreProfile_ForeshoreProfile_0_has_no_geometry_and_cannot_be_used,
- calculationConfiguration.ForeshoreProfile),
- calculation.Name);
- return false;
- }
- }
- return true;
- }
}
}
\ No newline at end of file
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfigurationReader.cs
===================================================================
diff -u -r4274bc4f40504c659612e15175dc635fc6e5bba9 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfigurationReader.cs (.../WaveConditionsCalculationConfigurationReader.cs) (revision 4274bc4f40504c659612e15175dc635fc6e5bba9)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfigurationReader.cs (.../WaveConditionsCalculationConfigurationReader.cs) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -87,10 +87,7 @@
StepSize = (ConfigurationWaveConditionsInputStepSize?) calculationElement.GetConvertedValueFromDescendantDoubleElement(WaveConditionsCalculationConfigurationSchemaIdentifiers.StepSize),
ForeshoreProfile = calculationElement.GetStringValueFromDescendantElement(WaveConditionsCalculationConfigurationSchemaIdentifiers.ForeshoreProfile),
Orientation = calculationElement.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.Orientation),
- UseBreakWater = calculationElement.GetBoolValueFromDescendantElement(ConfigurationSchemaIdentifiers.UseBreakWater),
- BreakWaterType = (ConfigurationBreakWaterType?) calculationElement.GetConvertedValueFromDescendantStringElement(ConfigurationSchemaIdentifiers.BreakWaterType),
- BreakWaterHeight = calculationElement.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.BreakWaterHeight),
- UseForeshore = calculationElement.GetBoolValueFromDescendantElement(ConfigurationSchemaIdentifiers.UseForeshore)
+ WaveReduction = calculationElement.GetWaveReductionParameters()
};
}
}
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfigurationWriter.cs
===================================================================
diff -u -r2057d3372084602a2d959db2e33dcf81de971a73 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfigurationWriter.cs (.../WaveConditionsCalculationConfigurationWriter.cs) (revision 2057d3372084602a2d959db2e33dcf81de971a73)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfigurationWriter.cs (.../WaveConditionsCalculationConfigurationWriter.cs) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -19,10 +19,8 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using System.Xml;
-using Ringtoets.Common.Data.Calculation;
-using Ringtoets.Common.Data.DikeProfiles;
-using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.IO.Configurations;
using Ringtoets.Common.IO.Configurations.Export;
using Ringtoets.Revetment.Data;
@@ -35,96 +33,89 @@
/// to XML format.
///
/// The type of calculations that are written to file.
- public abstract class WaveConditionsCalculationConfigurationWriter : CalculationConfigurationWriter where T : class, ICalculation
+ public class WaveConditionsCalculationConfigurationWriter : SchemaCalculationConfigurationWriter
{
private readonly ConfigurationWaveConditionsInputStepSizeConverter configurationWaveConditionsInputStepSizeConverter;
///
- /// Created a new instance of .
+ /// Creates a new instance of .
///
- protected WaveConditionsCalculationConfigurationWriter()
+ /// The path of the file to write to.
+ /// Thrown when is invalid.
+ /// A valid path:
+ ///
+ /// - is not empty or null,
+ /// - does not consist out of only whitespace characters,
+ /// - does not contain an invalid character,
+ /// - does not end with a directory or path separator (empty file name).
+ ///
+ public WaveConditionsCalculationConfigurationWriter(string filePath) : base(filePath)
{
configurationWaveConditionsInputStepSizeConverter = new ConfigurationWaveConditionsInputStepSizeConverter();
}
///
- /// Writes a single calculation with its in XML format to file.
+ /// Writes a single calculation with its in XML format to file.
///
- /// The name of the calculation to write.
- /// The input of the calculation to write.
+ /// The input of the calculation to write.
/// The writer to use for writing.
- protected void WriteCalculation(string name, WaveConditionsInput input, XmlWriter writer)
+ protected override void WriteCalculation(WaveConditionsCalculationConfiguration configuration, XmlWriter writer)
{
writer.WriteStartElement(ConfigurationSchemaIdentifiers.CalculationElement);
- writer.WriteAttributeString(ConfigurationSchemaIdentifiers.NameAttribute, name);
+ writer.WriteAttributeString(ConfigurationSchemaIdentifiers.NameAttribute, configuration.Name);
- WriteHydraulicBoundaryLocation(input.HydraulicBoundaryLocation, writer);
+ WriteElementWhenContentAvailable(
+ writer,
+ ConfigurationSchemaIdentifiers.HydraulicBoundaryLocationElement,
+ configuration.HydraulicBoundaryLocation);
- writer.WriteElementString(
+ WriteElementWhenContentAvailable(
+ writer,
WaveConditionsCalculationConfigurationSchemaIdentifiers.UpperBoundaryRevetment,
- XmlConvert.ToString(input.UpperBoundaryRevetment));
- writer.WriteElementString(
+ configuration.UpperBoundaryRevetment);
+ WriteElementWhenContentAvailable(
+ writer,
WaveConditionsCalculationConfigurationSchemaIdentifiers.LowerBoundaryRevetment,
- XmlConvert.ToString(input.LowerBoundaryRevetment));
- writer.WriteElementString(
+ configuration.LowerBoundaryRevetment);
+ WriteElementWhenContentAvailable(
+ writer,
WaveConditionsCalculationConfigurationSchemaIdentifiers.UpperBoundaryWaterLevels,
- XmlConvert.ToString(input.UpperBoundaryWaterLevels));
- writer.WriteElementString(
+ configuration.UpperBoundaryWaterLevels);
+ WriteElementWhenContentAvailable(
+ writer,
WaveConditionsCalculationConfigurationSchemaIdentifiers.LowerBoundaryWaterLevels,
- XmlConvert.ToString(input.LowerBoundaryWaterLevels));
- writer.WriteElementString(
- WaveConditionsCalculationConfigurationSchemaIdentifiers.StepSize,
- configurationWaveConditionsInputStepSizeConverter.ConvertToInvariantString((ConfigurationWaveConditionsInputStepSize) input.StepSize));
+ configuration.LowerBoundaryWaterLevels);
+ WriteConfigurationLoadSchematizationTypeWhenAvailable(
+ writer,
+ configuration.StepSize);
- WriteForeshoreProfile(input.ForeshoreProfile, writer);
+ WriteElementWhenContentAvailable(
+ writer,
+ WaveConditionsCalculationConfigurationSchemaIdentifiers.ForeshoreProfile,
+ configuration.ForeshoreProfile);
- writer.WriteElementString(
+ WriteElementWhenContentAvailable(
+ writer,
ConfigurationSchemaIdentifiers.Orientation,
- XmlConvert.ToString(input.Orientation));
+ configuration.Orientation);
- WriteWaveReduction(input, writer);
+ WriteWaveReductionWhenAvailable(writer, configuration.WaveReduction);
writer.WriteEndElement();
}
- private static void WriteHydraulicBoundaryLocation(HydraulicBoundaryLocation hydraulicBoundaryLocation, XmlWriter writer)
+ private static void WriteConfigurationLoadSchematizationTypeWhenAvailable(
+ XmlWriter writer,
+ ConfigurationWaveConditionsInputStepSize? configuration)
{
- if (hydraulicBoundaryLocation != null)
+ if (!configuration.HasValue)
{
- writer.WriteElementString(
- ConfigurationSchemaIdentifiers.HydraulicBoundaryLocationElement,
- hydraulicBoundaryLocation.Name);
+ return;
}
- }
- private static void WriteForeshoreProfile(ForeshoreProfile foreshoreProfile, XmlWriter writer)
- {
- if (foreshoreProfile != null)
- {
- writer.WriteElementString(
- WaveConditionsCalculationConfigurationSchemaIdentifiers.ForeshoreProfile,
- foreshoreProfile.Id);
- }
+ var converter = new ConfigurationWaveConditionsInputStepSizeConverter();
+ writer.WriteElementString(WaveConditionsCalculationConfigurationSchemaIdentifiers.StepSize,
+ converter.ConvertToInvariantString(configuration.Value));
}
-
- private static void WriteWaveReduction(WaveConditionsInput input, XmlWriter writer)
- {
- if (input.ForeshoreProfile != null)
- {
- writer.WriteStartElement(ConfigurationSchemaIdentifiers.WaveReduction);
-
- writer.WriteElementString(
- ConfigurationSchemaIdentifiers.UseBreakWater,
- XmlConvert.ToString(input.UseBreakWater));
-
- WriteBreakWaterProperties(input.BreakWater, writer);
-
- writer.WriteElementString(
- ConfigurationSchemaIdentifiers.UseForeshore,
- XmlConvert.ToString(input.UseForeshore));
-
- writer.WriteEndElement();
- }
- }
}
}
\ No newline at end of file
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Ringtoets.Revetment.IO.csproj
===================================================================
diff -u -r2057d3372084602a2d959db2e33dcf81de971a73 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Ringtoets.Revetment.IO.csproj (.../Ringtoets.Revetment.IO.csproj) (revision 2057d3372084602a2d959db2e33dcf81de971a73)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Ringtoets.Revetment.IO.csproj (.../Ringtoets.Revetment.IO.csproj) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -45,6 +45,8 @@
Properties\GlobalAssembly.cs
+
+
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/Helpers/WaveConditionsInputExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/Helpers/WaveConditionsInputExtensionsTest.cs (revision 0)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/Helpers/WaveConditionsInputExtensionsTest.cs (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -0,0 +1,135 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets 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 Core.Common.Base.Data;
+using NUnit.Framework;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.IO.Configurations;
+using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.IO.Configurations;
+using Ringtoets.Revetment.IO.Configurations.Helpers;
+
+namespace Ringtoets.Revetment.IO.Test.Configurations.Helpers
+{
+ [TestFixture]
+ public class WaveConditionsInputExtensionsTest
+ {
+ [Test]
+ public void ToConfiguration_WithoutInput_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => ((WaveConditionsInput) null).ToConfiguration("name");
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("input", exception.ParamName);
+ }
+
+ [Test]
+ public void ToConfiguration_WithoutName_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new WaveConditionsInput().ToConfiguration(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("value", exception.ParamName);
+ }
+
+ [Test]
+ public void ToConfiguration_InputValuesNotSet_ReturnsExpectedConfiguration()
+ {
+ // Setup
+ const string name = "name";
+
+ // Call
+ WaveConditionsCalculationConfiguration configuration = new WaveConditionsInput().ToConfiguration(name);
+
+ // Assert
+ Assert.AreEqual(name, configuration.Name);
+ Assert.IsNaN(configuration.LowerBoundaryRevetment);
+ Assert.IsNaN(configuration.UpperBoundaryRevetment);
+ Assert.IsNaN(configuration.LowerBoundaryWaterLevels);
+ Assert.IsNaN(configuration.UpperBoundaryWaterLevels);
+ Assert.IsNaN(configuration.Orientation);
+ Assert.AreEqual(ConfigurationWaveConditionsInputStepSize.Half, configuration.StepSize);
+ Assert.IsNull(configuration.HydraulicBoundaryLocation);
+ Assert.IsNull(configuration.ForeshoreProfile);
+ Assert.IsNull(configuration.WaveReduction);
+ }
+
+ [Test]
+ public void ToConfiguration_InputValuesSet_ReturnsExpectedConfiguration()
+ {
+ // Setup
+ const string name = "other name";
+ const string locationName = "name";
+ const string foreshoreProfileName = "foreshore";
+
+ const double breakWaterHeight = 9.22;
+ const double lowerBoundaryRevetment = 1.2;
+ const double upperBoundaryRevetment = 3.55;
+ const double lowerBoundaryWaterLevels = 3.1;
+ const double upperBoundaryWaterLevels = 8.66;
+ const int orientation = 122;
+
+ var input = new WaveConditionsInput
+ {
+ ForeshoreProfile = new TestForeshoreProfile(foreshoreProfileName),
+ HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(locationName),
+ LowerBoundaryRevetment = (RoundedDouble) lowerBoundaryRevetment,
+ UpperBoundaryRevetment = (RoundedDouble) upperBoundaryRevetment,
+ LowerBoundaryWaterLevels = (RoundedDouble) lowerBoundaryWaterLevels,
+ UpperBoundaryWaterLevels = (RoundedDouble) upperBoundaryWaterLevels,
+ StepSize = WaveConditionsInputStepSize.One,
+ Orientation = (RoundedDouble) orientation,
+ BreakWater =
+ {
+ Type = BreakWaterType.Wall,
+ Height = (RoundedDouble) breakWaterHeight
+ },
+ UseBreakWater = true,
+ UseForeshore = true
+ };
+
+ // Call
+ WaveConditionsCalculationConfiguration configuration = input.ToConfiguration(name);
+
+ // Assert
+ Assert.AreEqual(name, configuration.Name);
+ Assert.AreEqual(lowerBoundaryRevetment, configuration.LowerBoundaryRevetment);
+ Assert.AreEqual(upperBoundaryRevetment, configuration.UpperBoundaryRevetment);
+ Assert.AreEqual(lowerBoundaryWaterLevels, configuration.LowerBoundaryWaterLevels);
+ Assert.AreEqual(upperBoundaryWaterLevels, configuration.UpperBoundaryWaterLevels);
+ Assert.AreEqual(orientation, configuration.Orientation);
+ Assert.AreEqual(ConfigurationWaveConditionsInputStepSize.One, configuration.StepSize);
+ Assert.AreEqual(locationName, configuration.HydraulicBoundaryLocation);
+ Assert.AreEqual(foreshoreProfileName, configuration.ForeshoreProfile);
+ Assert.AreEqual(breakWaterHeight, configuration.WaveReduction.BreakWaterHeight);
+ Assert.AreEqual(ConfigurationBreakWaterType.Wall, configuration.WaveReduction.BreakWaterType);
+ Assert.IsTrue(configuration.WaveReduction.UseForeshoreProfile);
+ Assert.IsTrue(configuration.WaveReduction.UseBreakWater);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/Helpers/WaveReductionConversionExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/Helpers/WaveReductionConversionExtensionsTest.cs (revision 0)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/Helpers/WaveReductionConversionExtensionsTest.cs (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -0,0 +1,147 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets 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.Linq;
+using Core.Common.Base.Geometry;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.IO.Configurations;
+using Ringtoets.Common.IO.Configurations.Helpers;
+using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.IO.Configurations;
+using Ringtoets.Revetment.IO.Configurations.Helpers;
+
+namespace Ringtoets.Revetment.IO.Test.Configurations.Helpers
+{
+ [TestFixture]
+ public class WaveReductionConversionExtensionsTest
+ {
+ [Test]
+ public void SetConfigurationForeshoreProfileDependendProperties_ConfigurationNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ WaveConditionsCalculationConfiguration configuration = null;
+ var structureInput = new WaveConditionsInput();
+
+ // Call
+ TestDelegate call = () => configuration.SetConfigurationForeshoreProfileDependendProperties(structureInput);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("configuration", paramName);
+ }
+
+ [Test]
+ public void SetConfigurationForeshoreProfileDependendProperties_InputNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var configuration = new WaveConditionsCalculationConfiguration("name");
+
+ // Call
+ TestDelegate call = () => configuration.SetConfigurationForeshoreProfileDependendProperties(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("input", paramName);
+ }
+
+ [Test]
+ public void SetConfigurationForeshoreProfileDependendProperties_WithoutForeshoreProfile_DoesNotUpdate()
+ {
+ // Setup
+ var configuration = new WaveConditionsCalculationConfiguration("name");
+ var structureInput = new WaveConditionsInput();
+
+ // Call
+ configuration.SetConfigurationForeshoreProfileDependendProperties(structureInput);
+
+ // Assert
+ Assert.IsNull(configuration.ForeshoreProfile);
+ Assert.IsNull(configuration.WaveReduction);
+ }
+
+ [Test]
+ public void SetConfigurationForeshoreProfileDependendProperties_WithForeshoreProfile_UpdatesConfiguration()
+ {
+ // Setup
+ var random = new Random(6543);
+ var configuration = new WaveConditionsCalculationConfiguration("name");
+ var structureInput = new WaveConditionsInput
+ {
+ ForeshoreProfile = new ForeshoreProfile(new Point2D(0, 0),
+ Enumerable.Empty(),
+ new BreakWater(
+ BreakWaterType.Dam,
+ random.NextDouble()),
+ new ForeshoreProfile.ConstructionProperties
+ {
+ Id = "id",
+ Name = "profile"
+ }),
+ UseBreakWater = random.NextBoolean(),
+ UseForeshore = random.NextBoolean()
+ };
+
+ // Call
+ configuration.SetConfigurationForeshoreProfileDependendProperties(structureInput);
+
+ // Assert
+ Assert.AreEqual("id", configuration.ForeshoreProfile);
+ WaveReductionConfiguration waveReduction = configuration.WaveReduction;
+ Assert.AreEqual(structureInput.UseBreakWater, waveReduction.UseBreakWater);
+ Assert.AreEqual(structureInput.UseForeshore, waveReduction.UseForeshoreProfile);
+ Assert.AreEqual(ConfigurationBreakWaterType.Dam, waveReduction.BreakWaterType);
+ Assert.AreEqual(structureInput.BreakWater.Height, waveReduction.BreakWaterHeight);
+ }
+
+ [Test]
+ public void SetConfigurationForeshoreProfileDependendProperties_WithForeshoreProfileInvalidBreakwaterType_UpdatesConfiguration()
+ {
+ // Setup
+ var random = new Random(6543);
+ var configuration = new WaveConditionsCalculationConfiguration("name");
+ var structureInput = new WaveConditionsInput
+ {
+ ForeshoreProfile = new TestForeshoreProfile(new BreakWater(
+ (BreakWaterType) 999,
+ random.NextDouble())),
+ UseBreakWater = random.NextBoolean(),
+ UseForeshore = random.NextBoolean()
+ };
+
+ // Call
+ configuration.SetConfigurationForeshoreProfileDependendProperties(structureInput);
+
+ // Assert
+ Assert.AreEqual(structureInput.ForeshoreProfile.Id, configuration.ForeshoreProfile);
+ WaveReductionConfiguration waveReduction = configuration.WaveReduction;
+ Assert.AreEqual(structureInput.UseBreakWater, waveReduction.UseBreakWater);
+ Assert.AreEqual(structureInput.UseForeshore, waveReduction.UseForeshoreProfile);
+ Assert.IsNull(waveReduction.BreakWaterType);
+ Assert.AreEqual(structureInput.BreakWater.Height, waveReduction.BreakWaterHeight);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/WaveConditionsCalculationConfigurationReaderTest.cs
===================================================================
diff -u -r2057d3372084602a2d959db2e33dcf81de971a73 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/WaveConditionsCalculationConfigurationReaderTest.cs (.../WaveConditionsCalculationConfigurationReaderTest.cs) (revision 2057d3372084602a2d959db2e33dcf81de971a73)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/WaveConditionsCalculationConfigurationReaderTest.cs (.../WaveConditionsCalculationConfigurationReaderTest.cs) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -206,10 +206,7 @@
Assert.IsNull(calculation.StepSize);
Assert.IsNull(calculation.ForeshoreProfile);
Assert.IsNull(calculation.Orientation);
- Assert.IsNull(calculation.UseBreakWater);
- Assert.IsNull(calculation.BreakWaterType);
- Assert.IsNull(calculation.BreakWaterHeight);
- Assert.IsNull(calculation.UseForeshore);
+ Assert.IsNull(calculation.WaveReduction);
}
[Test]
@@ -227,10 +224,10 @@
var calculation = readItems[0] as WaveConditionsCalculationConfiguration;
Assert.IsNotNull(calculation);
- Assert.IsNull(calculation.UseBreakWater);
- Assert.IsNull(calculation.BreakWaterType);
- Assert.IsNull(calculation.BreakWaterHeight);
- Assert.IsNull(calculation.UseForeshore);
+ Assert.IsNull(calculation.WaveReduction.UseBreakWater);
+ Assert.IsNull(calculation.WaveReduction.BreakWaterType);
+ Assert.IsNull(calculation.WaveReduction.BreakWaterHeight);
+ Assert.IsNull(calculation.WaveReduction.UseForeshoreProfile);
}
[Test]
@@ -253,7 +250,7 @@
Assert.IsNaN(calculation.UpperBoundaryWaterLevels);
Assert.IsNaN(calculation.LowerBoundaryWaterLevels);
Assert.IsNaN(calculation.Orientation);
- Assert.IsNaN(calculation.BreakWaterHeight);
+ Assert.IsNaN(calculation.WaveReduction.BreakWaterHeight);
}
[Test]
@@ -277,14 +274,14 @@
Assert.NotNull(calculation.UpperBoundaryWaterLevels);
Assert.NotNull(calculation.LowerBoundaryWaterLevels);
Assert.NotNull(calculation.Orientation);
- Assert.NotNull(calculation.BreakWaterHeight);
+ Assert.NotNull(calculation.WaveReduction.BreakWaterHeight);
Assert.IsTrue(double.IsPositiveInfinity(calculation.UpperBoundaryRevetment.Value));
Assert.IsTrue(double.IsNegativeInfinity(calculation.LowerBoundaryRevetment.Value));
Assert.IsTrue(double.IsPositiveInfinity(calculation.UpperBoundaryWaterLevels.Value));
Assert.IsTrue(double.IsNegativeInfinity(calculation.LowerBoundaryWaterLevels.Value));
Assert.IsTrue(double.IsPositiveInfinity(calculation.Orientation.Value));
- Assert.IsTrue(double.IsPositiveInfinity(calculation.BreakWaterHeight.Value));
+ Assert.IsTrue(double.IsPositiveInfinity(calculation.WaveReduction.BreakWaterHeight.Value));
}
[Test]
@@ -313,10 +310,10 @@
Assert.AreEqual(ConfigurationWaveConditionsInputStepSize.Half, calculation.StepSize);
Assert.AreEqual("Voorlandprofiel", calculation.ForeshoreProfile);
Assert.AreEqual(5.5, calculation.Orientation);
- Assert.IsTrue(calculation.UseBreakWater);
- Assert.AreEqual(ConfigurationBreakWaterType.Caisson, calculation.BreakWaterType);
- Assert.AreEqual(6.6, calculation.BreakWaterHeight);
- Assert.IsFalse(calculation.UseForeshore);
+ Assert.IsTrue(calculation.WaveReduction.UseBreakWater);
+ Assert.AreEqual(ConfigurationBreakWaterType.Caisson, calculation.WaveReduction.BreakWaterType);
+ Assert.AreEqual(6.6, calculation.WaveReduction.BreakWaterHeight);
+ Assert.IsFalse(calculation.WaveReduction.UseForeshoreProfile);
}
[Test]
@@ -343,10 +340,10 @@
Assert.AreEqual(ConfigurationWaveConditionsInputStepSize.Half, calculation.StepSize);
Assert.IsNull(calculation.ForeshoreProfile);
Assert.IsNull(calculation.Orientation);
- Assert.IsTrue(calculation.UseBreakWater);
- Assert.AreEqual(ConfigurationBreakWaterType.Caisson, calculation.BreakWaterType);
- Assert.AreEqual(3.3, calculation.BreakWaterHeight);
- Assert.IsNull(calculation.UseForeshore);
+ Assert.IsTrue(calculation.WaveReduction.UseBreakWater);
+ Assert.AreEqual(ConfigurationBreakWaterType.Caisson, calculation.WaveReduction.BreakWaterType);
+ Assert.AreEqual(3.3, calculation.WaveReduction.BreakWaterHeight);
+ Assert.IsNull(calculation.WaveReduction.UseForeshoreProfile);
}
}
}
\ No newline at end of file
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/WaveConditionsCalculationConfigurationTest.cs
===================================================================
diff -u -r4274bc4f40504c659612e15175dc635fc6e5bba9 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/WaveConditionsCalculationConfigurationTest.cs (.../WaveConditionsCalculationConfigurationTest.cs) (revision 4274bc4f40504c659612e15175dc635fc6e5bba9)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/WaveConditionsCalculationConfigurationTest.cs (.../WaveConditionsCalculationConfigurationTest.cs) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -59,10 +59,7 @@
Assert.IsNull(readCalculation.StepSize);
Assert.IsNull(readCalculation.ForeshoreProfile);
Assert.IsNull(readCalculation.Orientation);
- Assert.IsNull(readCalculation.UseBreakWater);
- Assert.IsNull(readCalculation.BreakWaterType);
- Assert.IsNull(readCalculation.BreakWaterHeight);
- Assert.IsNull(readCalculation.UseForeshore);
+ Assert.IsNull(readCalculation.WaveReduction);
}
[Test]
@@ -85,7 +82,7 @@
// Call
var readWaveConditionsCalculation = new WaveConditionsCalculationConfiguration(calculationName)
- {
+ {
HydraulicBoundaryLocation = hydraulicBoundaryLocation,
UpperBoundaryRevetment = upperBoundaryRevetment,
LowerBoundaryRevetment = lowerBoundaryRevetment,
@@ -94,10 +91,13 @@
StepSize = stepSize,
ForeshoreProfile = foreshoreProfileName,
Orientation = orientation,
- UseBreakWater = useBreakWater,
- BreakWaterType = breakWaterType,
- BreakWaterHeight = breakWaterHeight,
- UseForeshore = useForeshore
+ WaveReduction = new WaveReductionConfiguration
+ {
+ UseBreakWater = useBreakWater,
+ BreakWaterType = breakWaterType,
+ BreakWaterHeight = breakWaterHeight,
+ UseForeshoreProfile = useForeshore
+ }
};
// Assert
@@ -110,10 +110,10 @@
Assert.AreEqual(stepSize, readWaveConditionsCalculation.StepSize);
Assert.AreEqual(foreshoreProfileName, readWaveConditionsCalculation.ForeshoreProfile);
Assert.AreEqual(orientation, readWaveConditionsCalculation.Orientation);
- Assert.AreEqual(useBreakWater, readWaveConditionsCalculation.UseBreakWater);
- Assert.AreEqual(breakWaterType, readWaveConditionsCalculation.BreakWaterType);
- Assert.AreEqual(breakWaterHeight, readWaveConditionsCalculation.BreakWaterHeight);
- Assert.AreEqual(useForeshore, readWaveConditionsCalculation.UseForeshore);
+ Assert.AreEqual(useBreakWater, readWaveConditionsCalculation.WaveReduction.UseBreakWater);
+ Assert.AreEqual(breakWaterType, readWaveConditionsCalculation.WaveReduction.BreakWaterType);
+ Assert.AreEqual(breakWaterHeight, readWaveConditionsCalculation.WaveReduction.BreakWaterHeight);
+ Assert.AreEqual(useForeshore, readWaveConditionsCalculation.WaveReduction.UseForeshoreProfile);
}
}
}
\ No newline at end of file
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/WaveConditionsCalculationConfigurationWriterTest.cs
===================================================================
diff -u -r2057d3372084602a2d959db2e33dcf81de971a73 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/WaveConditionsCalculationConfigurationWriterTest.cs (.../WaveConditionsCalculationConfigurationWriterTest.cs) (revision 2057d3372084602a2d959db2e33dcf81de971a73)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/WaveConditionsCalculationConfigurationWriterTest.cs (.../WaveConditionsCalculationConfigurationWriterTest.cs) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -28,8 +28,7 @@
using NUnit.Framework;
using Ringtoets.Common.Data;
using Ringtoets.Common.Data.Calculation;
-using Ringtoets.Common.Data.DikeProfiles;
-using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.IO.Configurations;
using Ringtoets.Common.IO.TestUtil;
using Ringtoets.Revetment.Data;
using Ringtoets.Revetment.IO.Configurations;
@@ -38,36 +37,33 @@
{
[TestFixture]
public class WaveConditionsCalculationConfigurationWriterTest
- : CustomCalculationConfigurationWriterDesignGuidelinesTestFixture<
- SimpleWaveConditionsCalculationConfigurationWriter,
- SimpleWaveConditionsCalculation>
+ : CustomSchemaCalculationConfigurationWriterDesignGuidelinesTestFixture<
+ WaveConditionsCalculationConfigurationWriter,
+ WaveConditionsCalculationConfiguration>
{
[Test]
- public void WriteCalculation_SparseCalculation_WritesSparseConfigurationToFile()
+ public void Write_SparseCalculation_WritesSparseConfigurationToFile()
{
// Setup
string filePath = TestHelper.GetScratchPadPath(
- $"{nameof(WriteCalculation_SparseCalculation_WritesSparseConfigurationToFile)}.xml");
+ $"{nameof(Write_SparseCalculation_WritesSparseConfigurationToFile)}.xml");
string expectedXmlFilePath = TestHelper.GetTestDataPath(
TestDataPath.Ringtoets.Revetment.IO,
- Path.Combine(nameof(WaveConditionsCalculationConfigurationWriter), "sparseConfiguration.xml"));
+ Path.Combine(nameof(WaveConditionsCalculationConfigurationWriter), "sparseConfiguration.xml"));
- var calculation = new SimpleWaveConditionsCalculation
- {
- Name = "Berekening 1"
- };
+ var calculation = new WaveConditionsCalculationConfiguration("Berekening 1");
try
{
- using (XmlWriter xmlWriter = CreateXmlWriter(filePath))
+ var writer = new WaveConditionsCalculationConfigurationWriter(filePath);
+
+ // Call
+ writer.Write(new[]
{
- var writer = new SimpleWaveConditionsCalculationConfigurationWriter();
+ calculation
+ });
- // Call
- writer.PublicWriteCalculation(calculation, xmlWriter);
- }
-
// Assert
string actualXml = File.ReadAllText(filePath);
string expectedXml = File.ReadAllText(expectedXmlFilePath);
@@ -81,49 +77,45 @@
}
[Test]
- public void WriteCalculation_CompleteCalculation_WritesCompleteConfigurationToFile()
+ public void Write_CompleteCalculation_WritesCompleteConfigurationToFile()
{
// Setup
string filePath = TestHelper.GetScratchPadPath(
- $"{nameof(WriteCalculation_CompleteCalculation_WritesCompleteConfigurationToFile)}.xml");
+ $"{nameof(Write_CompleteCalculation_WritesCompleteConfigurationToFile)}.xml");
string expectedXmlFilePath = TestHelper.GetTestDataPath(
TestDataPath.Ringtoets.Revetment.IO,
- Path.Combine(nameof(WaveConditionsCalculationConfigurationWriter), "completeConfiguration.xml"));
+ Path.Combine(nameof(WaveConditionsCalculationConfigurationWriter), "completeConfiguration.xml"));
- var calculation = new SimpleWaveConditionsCalculation
+ var calculation = new WaveConditionsCalculationConfiguration("Berekening 1")
{
- Name = "Berekening 1",
- Input =
+ HydraulicBoundaryLocation = "Locatie1",
+ UpperBoundaryRevetment = (RoundedDouble) 1.5,
+ LowerBoundaryRevetment = (RoundedDouble) 0.5,
+ UpperBoundaryWaterLevels = (RoundedDouble) 1.4,
+ LowerBoundaryWaterLevels = (RoundedDouble) 0.6,
+ StepSize = ConfigurationWaveConditionsInputStepSize.One,
+ ForeshoreProfile = "profiel1",
+ Orientation = (RoundedDouble) 67.1,
+ WaveReduction = new WaveReductionConfiguration
{
- HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation("Locatie1"),
- UpperBoundaryRevetment = (RoundedDouble) 1.5,
- LowerBoundaryRevetment = (RoundedDouble) 0.5,
- UpperBoundaryWaterLevels = (RoundedDouble) 1.4,
- LowerBoundaryWaterLevels = (RoundedDouble) 0.6,
- StepSize = WaveConditionsInputStepSize.One,
- ForeshoreProfile = new TestForeshoreProfile("profiel1"),
- Orientation = (RoundedDouble) 67.1,
- UseForeshore = true,
+ UseForeshoreProfile = true,
UseBreakWater = true,
- BreakWater =
- {
- Height = (RoundedDouble) 1.23,
- Type = BreakWaterType.Dam
- }
+ BreakWaterHeight = (RoundedDouble) 1.23,
+ BreakWaterType = ConfigurationBreakWaterType.Dam
}
};
try
{
- using (XmlWriter xmlWriter = CreateXmlWriter(filePath))
+ var writer = new WaveConditionsCalculationConfigurationWriter(filePath);
+
+ // Call
+ writer.Write(new[]
{
- var writer = new SimpleWaveConditionsCalculationConfigurationWriter();
+ calculation
+ });
- // Call
- writer.PublicWriteCalculation(calculation, xmlWriter);
- }
-
// Assert
string actualXml = File.ReadAllText(filePath);
string expectedXml = File.ReadAllText(expectedXmlFilePath);
@@ -136,28 +128,12 @@
}
}
- private static XmlWriter CreateXmlWriter(string filePath)
+ protected override WaveConditionsCalculationConfigurationWriter CreateWriterInstance(string filePath)
{
- return XmlWriter.Create(filePath, new XmlWriterSettings
- {
- Indent = true
- });
+ return new WaveConditionsCalculationConfigurationWriter(filePath);
}
}
- public class SimpleWaveConditionsCalculationConfigurationWriter : WaveConditionsCalculationConfigurationWriter
- {
- public void PublicWriteCalculation(SimpleWaveConditionsCalculation calculation, XmlWriter writer)
- {
- WriteCalculation(calculation, writer);
- }
-
- protected override void WriteCalculation(SimpleWaveConditionsCalculation calculation, XmlWriter writer)
- {
- WriteCalculation(calculation.Name, calculation.Input, writer);
- }
- }
-
public class SimpleWaveConditionsCalculation : Observable, ICalculation
{
public WaveConditionsInput Input { get; } = new WaveConditionsInput();
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Ringtoets.Revetment.IO.Test.csproj
===================================================================
diff -u -r2057d3372084602a2d959db2e33dcf81de971a73 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Ringtoets.Revetment.IO.Test.csproj (.../Ringtoets.Revetment.IO.Test.csproj) (revision 2057d3372084602a2d959db2e33dcf81de971a73)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Ringtoets.Revetment.IO.Test.csproj (.../Ringtoets.Revetment.IO.Test.csproj) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -50,6 +50,8 @@
Properties\GlobalAssembly.cs
+
+
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationWriter/completeConfiguration.xml
===================================================================
diff -u -rf01786afaf51ad02f5be5e2a320461ebfe576bba -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationWriter/completeConfiguration.xml (.../completeConfiguration.xml) (revision f01786afaf51ad02f5be5e2a320461ebfe576bba)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationWriter/completeConfiguration.xml (.../completeConfiguration.xml) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -1,17 +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
+
+
+ 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: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationWriter/sparseConfiguration.xml
===================================================================
diff -u -r316d1a999215783c0fedc22da425d5dd6435bd02 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationWriter/sparseConfiguration.xml (.../sparseConfiguration.xml) (revision 316d1a999215783c0fedc22da425d5dd6435bd02)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationWriter/sparseConfiguration.xml (.../sparseConfiguration.xml) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -1,9 +1,4 @@
-
- NaN
- NaN
- NaN
- NaN
- 0.5
- NaN
-
\ No newline at end of file
+
+
+
\ No newline at end of file
Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.IO/Exporters/StabilityStoneCoverCalculationConfigurationExporter.cs
===================================================================
diff -u -r94f2ec1496623ae488b567f883e66b4d26243441 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.IO/Exporters/StabilityStoneCoverCalculationConfigurationExporter.cs (.../StabilityStoneCoverCalculationConfigurationExporter.cs) (revision 94f2ec1496623ae488b567f883e66b4d26243441)
+++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.IO/Exporters/StabilityStoneCoverCalculationConfigurationExporter.cs (.../StabilityStoneCoverCalculationConfigurationExporter.cs) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -23,16 +23,17 @@
using System.Collections.Generic;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.IO.Configurations.Export;
+using Ringtoets.Revetment.IO.Configurations;
+using Ringtoets.Revetment.IO.Configurations.Helpers;
using Ringtoets.StabilityStoneCover.Data;
-using Ringtoets.StabilityStoneCover.IO.Writers;
namespace Ringtoets.StabilityStoneCover.IO.Exporters
{
///
/// Exports a stability stone cover calculation configuration and stores it as an XML file.
///
public class StabilityStoneCoverCalculationConfigurationExporter
- : CalculationConfigurationExporter
+ : SchemaCalculationConfigurationExporter
{
///
/// Creates a new instance of .
@@ -43,5 +44,15 @@
/// Thrown when is invalid.
public StabilityStoneCoverCalculationConfigurationExporter(IEnumerable configuration, string filePath)
: base(configuration, filePath) {}
+
+ protected override WaveConditionsCalculationConfigurationWriter CreateWriter(string filePath)
+ {
+ return new WaveConditionsCalculationConfigurationWriter(filePath);
+ }
+
+ protected override WaveConditionsCalculationConfiguration ToConfiguration(StabilityStoneCoverWaveConditionsCalculation calculation)
+ {
+ return calculation.InputParameters.ToConfiguration(calculation.Name);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.IO/Ringtoets.StabilityStoneCover.IO.csproj
===================================================================
diff -u -r96cd93f1a08294e5af3fec5f5ae0b59cbe914c4b -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.IO/Ringtoets.StabilityStoneCover.IO.csproj (.../Ringtoets.StabilityStoneCover.IO.csproj) (revision 96cd93f1a08294e5af3fec5f5ae0b59cbe914c4b)
+++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.IO/Ringtoets.StabilityStoneCover.IO.csproj (.../Ringtoets.StabilityStoneCover.IO.csproj) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -41,7 +41,6 @@
Properties\GlobalAssembly.cs
-
Fisheye: Tag 4fa75e2c07753d69a156377821eec5caaff7fc11 refers to a dead (removed) revision in file `Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.IO/Writers/StabilityStoneCoverCalculationConfigurationWriter.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/Exporters/StabilityStoneCoverCalculationConfigurationExporterTest.cs
===================================================================
diff -u -r94f2ec1496623ae488b567f883e66b4d26243441 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/Exporters/StabilityStoneCoverCalculationConfigurationExporterTest.cs (.../StabilityStoneCoverCalculationConfigurationExporterTest.cs) (revision 94f2ec1496623ae488b567f883e66b4d26243441)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/Exporters/StabilityStoneCoverCalculationConfigurationExporterTest.cs (.../StabilityStoneCoverCalculationConfigurationExporterTest.cs) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -19,25 +19,27 @@
// 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 Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.IO.TestUtil;
+using Ringtoets.Revetment.IO.Configurations;
using Ringtoets.StabilityStoneCover.Data;
using Ringtoets.StabilityStoneCover.IO.Exporters;
-using Ringtoets.StabilityStoneCover.IO.Writers;
namespace Ringtoets.StabilityStoneCover.IO.Test.Exporters
{
[TestFixture]
public class StabilityStoneCoverCalculationConfigurationExporterTest
- : CustomCalculationConfigurationExporterDesignGuidelinesTestFixture<
+ : CustomSchemaCalculationConfigurationExporterDesignGuidelinesTestFixture<
StabilityStoneCoverCalculationConfigurationExporter,
- StabilityStoneCoverCalculationConfigurationWriter,
- StabilityStoneCoverWaveConditionsCalculation>
+ WaveConditionsCalculationConfigurationWriter,
+ StabilityStoneCoverWaveConditionsCalculation,
+ WaveConditionsCalculationConfiguration>
{
[Test]
public void Export_ValidData_ReturnTrueAndWritesFile()
@@ -94,5 +96,10 @@
{
return new StabilityStoneCoverWaveConditionsCalculation();
}
+
+ protected override StabilityStoneCoverCalculationConfigurationExporter CallConfigurationFilePathConstructor(IEnumerable calculations, string filePath)
+ {
+ return new StabilityStoneCoverCalculationConfigurationExporter(calculations, filePath);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/Ringtoets.StabilityStoneCover.IO.Test.csproj
===================================================================
diff -u -r4a94b04e58009fa943f7db933c59bdd680621ff2 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/Ringtoets.StabilityStoneCover.IO.Test.csproj (.../Ringtoets.StabilityStoneCover.IO.Test.csproj) (revision 4a94b04e58009fa943f7db933c59bdd680621ff2)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/Ringtoets.StabilityStoneCover.IO.Test.csproj (.../Ringtoets.StabilityStoneCover.IO.Test.csproj) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -50,7 +50,6 @@
Properties\GlobalAssembly.cs
-
Fisheye: Tag 4fa75e2c07753d69a156377821eec5caaff7fc11 refers to a dead (removed) revision in file `Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/Writers/StabilityStoneCoverCalculationConfigurationWriterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/Exporters/WaveImpactAsphaltCoverCalculationConfigurationExporter.cs
===================================================================
diff -u -r08d25a2d4cd349395730ef39d3abf2cc51c30508 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/Exporters/WaveImpactAsphaltCoverCalculationConfigurationExporter.cs (.../WaveImpactAsphaltCoverCalculationConfigurationExporter.cs) (revision 08d25a2d4cd349395730ef39d3abf2cc51c30508)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/Exporters/WaveImpactAsphaltCoverCalculationConfigurationExporter.cs (.../WaveImpactAsphaltCoverCalculationConfigurationExporter.cs) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -23,16 +23,17 @@
using System.Collections.Generic;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.IO.Configurations.Export;
+using Ringtoets.Revetment.IO.Configurations;
+using Ringtoets.Revetment.IO.Configurations.Helpers;
using Ringtoets.WaveImpactAsphaltCover.Data;
-using Ringtoets.WaveImpactAsphaltCover.IO.Writers;
namespace Ringtoets.WaveImpactAsphaltCover.IO.Exporters
{
///
/// Exports a wave impact asphalt cover calculation configuration and stores it as an XML file.
///
public class WaveImpactAsphaltCoverCalculationConfigurationExporter
- : CalculationConfigurationExporter
+ : SchemaCalculationConfigurationExporter
{
///
/// Creates a new instance of .
@@ -43,5 +44,15 @@
/// Thrown when is invalid.
public WaveImpactAsphaltCoverCalculationConfigurationExporter(IEnumerable configuration, string filePath)
: base(configuration, filePath) {}
+
+ protected override WaveConditionsCalculationConfigurationWriter CreateWriter(string filePath)
+ {
+ return new WaveConditionsCalculationConfigurationWriter(filePath);
+ }
+
+ protected override WaveConditionsCalculationConfiguration ToConfiguration(WaveImpactAsphaltCoverWaveConditionsCalculation calculation)
+ {
+ return calculation.InputParameters.ToConfiguration(calculation.Name);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/Ringtoets.WaveImpactAsphaltCover.IO.csproj
===================================================================
diff -u -r96cd93f1a08294e5af3fec5f5ae0b59cbe914c4b -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/Ringtoets.WaveImpactAsphaltCover.IO.csproj (.../Ringtoets.WaveImpactAsphaltCover.IO.csproj) (revision 96cd93f1a08294e5af3fec5f5ae0b59cbe914c4b)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/Ringtoets.WaveImpactAsphaltCover.IO.csproj (.../Ringtoets.WaveImpactAsphaltCover.IO.csproj) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -41,7 +41,6 @@
Properties\GlobalAssembly.cs
-
Fisheye: Tag 4fa75e2c07753d69a156377821eec5caaff7fc11 refers to a dead (removed) revision in file `Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/Writers/WaveImpactAsphaltCoverCalculationConfigurationWriter.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/Exporters/WaveImpactAsphaltCoverCalculationConfigurationExporterTest.cs
===================================================================
diff -u -r08d25a2d4cd349395730ef39d3abf2cc51c30508 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/Exporters/WaveImpactAsphaltCoverCalculationConfigurationExporterTest.cs (.../WaveImpactAsphaltCoverCalculationConfigurationExporterTest.cs) (revision 08d25a2d4cd349395730ef39d3abf2cc51c30508)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/Exporters/WaveImpactAsphaltCoverCalculationConfigurationExporterTest.cs (.../WaveImpactAsphaltCoverCalculationConfigurationExporterTest.cs) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -19,25 +19,27 @@
// 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 Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.IO.TestUtil;
+using Ringtoets.Revetment.IO.Configurations;
using Ringtoets.WaveImpactAsphaltCover.Data;
using Ringtoets.WaveImpactAsphaltCover.IO.Exporters;
-using Ringtoets.WaveImpactAsphaltCover.IO.Writers;
namespace Ringtoets.WaveImpactAsphaltCover.IO.Test.Exporters
{
[TestFixture]
public class WaveImpactAsphaltCoverCalculationConfigurationExporterTest
- : CustomCalculationConfigurationExporterDesignGuidelinesTestFixture<
+ : CustomSchemaCalculationConfigurationExporterDesignGuidelinesTestFixture<
WaveImpactAsphaltCoverCalculationConfigurationExporter,
- WaveImpactAsphaltCoverCalculationConfigurationWriter,
- WaveImpactAsphaltCoverWaveConditionsCalculation>
+ WaveConditionsCalculationConfigurationWriter,
+ WaveImpactAsphaltCoverWaveConditionsCalculation,
+ WaveConditionsCalculationConfiguration>
{
[Test]
public void Export_ValidData_ReturnTrueAndWritesFile()
@@ -95,5 +97,10 @@
{
return new WaveImpactAsphaltCoverWaveConditionsCalculation();
}
+
+ protected override WaveImpactAsphaltCoverCalculationConfigurationExporter CallConfigurationFilePathConstructor(IEnumerable calculations, string filePath)
+ {
+ return new WaveImpactAsphaltCoverCalculationConfigurationExporter(calculations, filePath);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj
===================================================================
diff -u -r4a94b04e58009fa943f7db933c59bdd680621ff2 -r4fa75e2c07753d69a156377821eec5caaff7fc11
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj) (revision 4a94b04e58009fa943f7db933c59bdd680621ff2)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj) (revision 4fa75e2c07753d69a156377821eec5caaff7fc11)
@@ -50,7 +50,6 @@
Properties\GlobalAssembly.cs
-
Fisheye: Tag 4fa75e2c07753d69a156377821eec5caaff7fc11 refers to a dead (removed) revision in file `Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/Writers/WaveImpactAsphaltCoverCalculationConfigurationWriterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?