Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfiguration.cs
===================================================================
diff -u -r2057d3372084602a2d959db2e33dcf81de971a73 -r4274bc4f40504c659612e15175dc635fc6e5bba9
--- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfiguration.cs (.../WaveConditionsCalculationConfiguration.cs) (revision 2057d3372084602a2d959db2e33dcf81de971a73)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfiguration.cs (.../WaveConditionsCalculationConfiguration.cs) (revision 4274bc4f40504c659612e15175dc635fc6e5bba9)
@@ -29,94 +29,97 @@
///
public class WaveConditionsCalculationConfiguration : IConfigurationItem
{
+ private string name;
+
///
/// Creates a new instance of .
///
- /// The container of the properties for the .
- /// Thrown when is null.
- public WaveConditionsCalculationConfiguration(ConstructionProperties constructionProperties)
+ /// The name of the .
+ /// Thrown when is null.
+ public WaveConditionsCalculationConfiguration(string name)
{
- if (constructionProperties == null)
- {
- throw new ArgumentNullException(nameof(constructionProperties));
- }
-
- Name = constructionProperties.Name;
- HydraulicBoundaryLocation = constructionProperties.HydraulicBoundaryLocation;
- UpperBoundaryRevetment = constructionProperties.UpperBoundaryRevetment;
- LowerBoundaryRevetment = constructionProperties.LowerBoundaryRevetment;
- UpperBoundaryWaterLevels = constructionProperties.UpperBoundaryWaterLevels;
- LowerBoundaryWaterLevels = constructionProperties.LowerBoundaryWaterLevels;
- StepSize = constructionProperties.StepSize;
- ForeshoreProfile = constructionProperties.ForeshoreProfile;
- Orientation = constructionProperties.Orientation;
- UseBreakWater = constructionProperties.UseBreakWater;
- BreakWaterType = constructionProperties.BreakWaterType;
- BreakWaterHeight = constructionProperties.BreakWaterHeight;
- UseForeshore = constructionProperties.UseForeshore;
+ Name = name;
}
///
/// Gets the name of the hydraulic boundary location of the read calculation.
///
- public string HydraulicBoundaryLocation { get; }
+ public string HydraulicBoundaryLocation { get; set; }
///
/// Gets the upper boundary of the revetment of the read calculation.
///
- public double? UpperBoundaryRevetment { get; }
+ public double? UpperBoundaryRevetment { get; set; }
///
/// Gets the lower boundary of the revetment of the read calculation.
///
- public double? LowerBoundaryRevetment { get; }
+ public double? LowerBoundaryRevetment { get; set; }
///
/// Gets the upper boundary of the water levels of the read calculation.
///
- public double? UpperBoundaryWaterLevels { get; }
+ public double? UpperBoundaryWaterLevels { get; set; }
///
/// Gets the lower boundary of the water levels of the read calculation.
///
- public double? LowerBoundaryWaterLevels { get; }
+ public double? LowerBoundaryWaterLevels { get; set; }
///
/// Gets the step size of the read calculation.
///
- public ConfigurationWaveConditionsInputStepSize? StepSize { get; }
+ public ConfigurationWaveConditionsInputStepSize? StepSize { get; set; }
///
/// Gets the name of the foreshore profile of the read calculation.
///
- public string ForeshoreProfile { get; }
+ public string ForeshoreProfile { get; set; }
///
/// Gets the orientation of the read calculation.
///
- public double? Orientation { get; }
+ public double? Orientation { get; set; }
///
/// Gets whether the breakwater should be used for the read calculation.
///
- public bool? UseBreakWater { get; }
+ public bool? UseBreakWater { get; set; }
///
/// Gets the breakwater type of the read calculation.
///
- public ConfigurationBreakWaterType? BreakWaterType { get; }
+ public ConfigurationBreakWaterType? BreakWaterType { get; set; }
///
/// Gets the breakwater height of the read calculation.
///
- public double? BreakWaterHeight { get; }
+ public double? BreakWaterHeight { get; set; }
///
/// Gets whether the foreshore should be used for the read calculation.
///
- public bool? UseForeshore { get; }
+ public bool? UseForeshore { get; set; }
- public string Name { get; }
+ ///
+ /// Gets or sets the name of the .
+ ///
+ /// Thrown when is null.
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+ set
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value), @"Name is required for a structure calculation configuration.");
+ }
+ name = value;
+ }
+ }
///
/// Class holding the various construction parameters for .
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfigurationReader.cs
===================================================================
diff -u -r2057d3372084602a2d959db2e33dcf81de971a73 -r4274bc4f40504c659612e15175dc635fc6e5bba9
--- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfigurationReader.cs (.../WaveConditionsCalculationConfigurationReader.cs) (revision 2057d3372084602a2d959db2e33dcf81de971a73)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Configurations/WaveConditionsCalculationConfigurationReader.cs (.../WaveConditionsCalculationConfigurationReader.cs) (revision 4274bc4f40504c659612e15175dc635fc6e5bba9)
@@ -77,9 +77,8 @@
protected override WaveConditionsCalculationConfiguration ParseCalculationElement(XElement calculationElement)
{
- var constructionProperties = new WaveConditionsCalculationConfiguration.ConstructionProperties
- {
- Name = calculationElement.Attribute(ConfigurationSchemaIdentifiers.NameAttribute).Value,
+ return new WaveConditionsCalculationConfiguration(calculationElement.Attribute(ConfigurationSchemaIdentifiers.NameAttribute).Value)
+ {
HydraulicBoundaryLocation = calculationElement.GetStringValueFromDescendantElement(ConfigurationSchemaIdentifiers.HydraulicBoundaryLocationElement),
UpperBoundaryRevetment = calculationElement.GetDoubleValueFromDescendantElement(WaveConditionsCalculationConfigurationSchemaIdentifiers.UpperBoundaryRevetment),
LowerBoundaryRevetment = calculationElement.GetDoubleValueFromDescendantElement(WaveConditionsCalculationConfigurationSchemaIdentifiers.LowerBoundaryRevetment),
@@ -93,8 +92,6 @@
BreakWaterHeight = calculationElement.GetDoubleValueFromDescendantElement(ConfigurationSchemaIdentifiers.BreakWaterHeight),
UseForeshore = calculationElement.GetBoolValueFromDescendantElement(ConfigurationSchemaIdentifiers.UseForeshore)
};
-
- return new WaveConditionsCalculationConfiguration(constructionProperties);
}
}
}
\ No newline at end of file
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/WaveConditionsCalculationConfigurationTest.cs
===================================================================
diff -u -r2057d3372084602a2d959db2e33dcf81de971a73 -r4274bc4f40504c659612e15175dc635fc6e5bba9
--- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/WaveConditionsCalculationConfigurationTest.cs (.../WaveConditionsCalculationConfigurationTest.cs) (revision 2057d3372084602a2d959db2e33dcf81de971a73)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Configurations/WaveConditionsCalculationConfigurationTest.cs (.../WaveConditionsCalculationConfigurationTest.cs) (revision 4274bc4f40504c659612e15175dc635fc6e5bba9)
@@ -36,19 +36,21 @@
TestDelegate test = () => new WaveConditionsCalculationConfiguration(null);
// Assert
- var exception = Assert.Throws(test);
- Assert.AreEqual("constructionProperties", exception.ParamName);
+ Assert.Throws(test);
}
[Test]
public void Constructor_ConstructionPropertiesWithoutValues_PropertiesAreDefault()
{
+ // Setup
+ var name = "some name";
+
// Call
- var readCalculation = new WaveConditionsCalculationConfiguration(new WaveConditionsCalculationConfiguration.ConstructionProperties());
+ var readCalculation = new WaveConditionsCalculationConfiguration(name);
// Assert
Assert.IsInstanceOf(readCalculation);
- Assert.IsNull(readCalculation.Name);
+ Assert.AreEqual(name, readCalculation.Name);
Assert.IsNull(readCalculation.HydraulicBoundaryLocation);
Assert.IsNull(readCalculation.UpperBoundaryRevetment);
Assert.IsNull(readCalculation.LowerBoundaryRevetment);
@@ -82,9 +84,8 @@
const bool useForeshore = false;
// Call
- var readWaveConditionsCalculation = new WaveConditionsCalculationConfiguration(new WaveConditionsCalculationConfiguration.ConstructionProperties
- {
- Name = calculationName,
+ var readWaveConditionsCalculation = new WaveConditionsCalculationConfiguration(calculationName)
+ {
HydraulicBoundaryLocation = hydraulicBoundaryLocation,
UpperBoundaryRevetment = upperBoundaryRevetment,
LowerBoundaryRevetment = lowerBoundaryRevetment,
@@ -97,7 +98,7 @@
BreakWaterType = breakWaterType,
BreakWaterHeight = breakWaterHeight,
UseForeshore = useForeshore
- });
+ };
// Assert
Assert.AreEqual(calculationName, readWaveConditionsCalculation.Name);