Index: Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/StructureCalculationConfiguration.cs
===================================================================
diff -u -rf3feb7d017a933271c410470add90ae106745ceb -r4011a127978bb211ddb1101a2c608ed9c991d06d
--- Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/StructureCalculationConfiguration.cs (.../StructureCalculationConfiguration.cs) (revision f3feb7d017a933271c410470add90ae106745ceb)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/StructureCalculationConfiguration.cs (.../StructureCalculationConfiguration.cs) (revision 4011a127978bb211ddb1101a2c608ed9c991d06d)
@@ -19,17 +19,40 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
+
namespace Ringtoets.Common.IO.Configurations
{
///
/// Configuration of a structure calculation.
///
public abstract class StructureCalculationConfiguration
{
+ private string name;
+
+ protected StructureCalculationConfiguration(string name)
+ {
+ Name = name;
+ }
+
///
/// Gets or sets the name of the calculation.
///
- public string Name { get; set; }
+ 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;
+ }
+ }
///
/// Gets or sets the stochast configuration for the model factor super critical flow.
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Schema/ConfigurationSchemaIdentifiers.cs
===================================================================
diff -u -r7ce0229b2d4293c464479e448b092c7f83eb94c3 -r4011a127978bb211ddb1101a2c608ed9c991d06d
--- Ringtoets/Common/src/Ringtoets.Common.IO/Schema/ConfigurationSchemaIdentifiers.cs (.../ConfigurationSchemaIdentifiers.cs) (revision 7ce0229b2d4293c464479e448b092c7f83eb94c3)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Schema/ConfigurationSchemaIdentifiers.cs (.../ConfigurationSchemaIdentifiers.cs) (revision 4011a127978bb211ddb1101a2c608ed9c991d06d)
@@ -52,6 +52,13 @@
public const string HydraulicBoundaryLocationElement = "hrlocatie";
///
+ /// The tag of elements containing the orientation of the profile.
+ ///
+ public const string Orientation = "orientatie";
+
+ #region stochasts
+
+ ///
/// The identifier for stochasts elements.
///
public const string StochastsElement = "stochasten";
@@ -77,11 +84,45 @@
public const string VariationCoefficientElement = "variatiecoefficient";
///
- /// The tag of elements containing the orientation of the profile.
+ /// The identifier for the phreatic level exit stochast name.
///
- public const string Orientation = "orientatie";
+ internal const string AllowedLevelIncreaseStorageStochastName = "peilverhogingkomberging";
///
+ /// The identifier for the critical overtopping discharge stochast name.
+ ///
+ internal const string CriticalOvertoppingDischargeStochastName = "kritiekinstromenddebiet";
+
+ ///
+ /// The identifier for the model factor super critical flow stochast name.
+ ///
+ internal const string ModelFactorSuperCriticalFlowStochastName = "modelfactoroverloopdebiet";
+
+ ///
+ /// The identifier for the model factor super critical flow stochast name.
+ ///
+ internal const string FlowWidthAtBottomProtectionStochastName = "breedtebodembescherming";
+
+ ///
+ /// The identifier for the storage structure area stochast name.
+ ///
+ internal const string StorageStructureAreaStochastName = "kombergendoppervlak";
+
+ ///
+ /// The identifier for the storm duration stochast name.
+ ///
+ internal const string StormDurationStochastName = "stormduur";
+
+ ///
+ /// The identifier for the width flow apertures stochast name.
+ ///
+ internal const string WidthFlowAperturesStochastName = "breedtedoorstroomopening";
+
+ #endregion
+
+ #region wave reduction
+
+ ///
/// The tag of elements containing parameters that define wave reduction.
///
public const string WaveReduction = "golfreductie";
@@ -123,5 +164,26 @@
/// wall type of break water.
///
public const string BreakWaterWall = "verticalewand";
+
+ #endregion
+
+ #region structure calculation
+
+ ///
+ /// The tag of elements containing the failure probability of a structure with erosion.
+ ///
+ public const string FailureProbabilityStructureWithErosionElement = "faalkansgegevenerosiebodem";
+
+ ///
+ /// The tag of elements containing the name of the structure.
+ ///
+ public const string StructureElement = "kunstwerk";
+
+ ///
+ /// The tag of elements containing the name of the foreshore profile.
+ ///
+ public const string ForeshoreProfileNameElement = "voorlandprofiel";
+
+ #endregion
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Writers/XmlWriterExtensions.cs
===================================================================
diff -u -rbd630045ef64f5b7e321021205aae3a4d32f4a5e -r4011a127978bb211ddb1101a2c608ed9c991d06d
--- Ringtoets/Common/src/Ringtoets.Common.IO/Writers/XmlWriterExtensions.cs (.../XmlWriterExtensions.cs) (revision bd630045ef64f5b7e321021205aae3a4d32f4a5e)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Writers/XmlWriterExtensions.cs (.../XmlWriterExtensions.cs) (revision 4011a127978bb211ddb1101a2c608ed9c991d06d)
@@ -38,6 +38,19 @@
/// in an invalid state for writing.
public static void WriteDistribution(this XmlWriter writer, string name, MeanStandardDeviationStochastConfiguration distribution)
{
+ if (writer == null)
+ {
+ throw new ArgumentNullException(nameof(writer));
+ }
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+ if (distribution == null)
+ {
+ throw new ArgumentNullException(nameof(distribution));
+ }
+
writer.WriteStartElement(ConfigurationSchemaIdentifiers.StochastElement);
writer.WriteAttributeString(ConfigurationSchemaIdentifiers.NameAttribute, name);
@@ -63,6 +76,19 @@
/// in an invalid state for writing.
public static void WriteDistribution(this XmlWriter writer, string name, MeanVariationCoefficientStochastConfiguration distribution)
{
+ if (writer == null)
+ {
+ throw new ArgumentNullException(nameof(writer));
+ }
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+ if (distribution == null)
+ {
+ throw new ArgumentNullException(nameof(distribution));
+ }
+
writer.WriteStartElement(ConfigurationSchemaIdentifiers.StochastElement);
writer.WriteAttributeString(ConfigurationSchemaIdentifiers.NameAttribute, name);
@@ -87,6 +113,15 @@
/// in an invalid state for writing.
public static void WriteWaveReduction(this XmlWriter writer, WaveReductionConfiguration waveReduction)
{
+ if (writer == null)
+ {
+ throw new ArgumentNullException(nameof(writer));
+ }
+ if (waveReduction == null)
+ {
+ throw new ArgumentNullException(nameof(waveReduction));
+ }
+
writer.WriteStartElement(ConfigurationSchemaIdentifiers.WaveReduction);
if (waveReduction.UseBreakWater.HasValue)
@@ -108,5 +143,97 @@
writer.WriteEndElement();
}
+
+ ///
+ /// Writes the common properties of structure configurations to file, without closing the element.
+ ///
+ /// The writer to use to write the properties.
+ /// The common properties to write.
+ public static void WriteStartCommonStructureProperties(this XmlWriter writer, StructureCalculationConfiguration structureCalculation)
+ {
+ if (writer == null)
+ {
+ throw new ArgumentNullException(nameof(writer));
+ }
+ if (structureCalculation == null)
+ {
+ throw new ArgumentNullException(nameof(structureCalculation));
+ }
+
+ writer.WriteStartElement(ConfigurationSchemaIdentifiers.CalculationElement);
+ writer.WriteAttributeString(ConfigurationSchemaIdentifiers.NameAttribute, structureCalculation.Name);
+
+ if (structureCalculation.FailureProbabilityStructureWithErosion.HasValue)
+ {
+ writer.WriteElementString(
+ ConfigurationSchemaIdentifiers.FailureProbabilityStructureWithErosionElement,
+ XmlConvert.ToString(structureCalculation.FailureProbabilityStructureWithErosion.Value));
+ }
+ if (structureCalculation.StructureNormalOrientation.HasValue)
+ {
+ writer.WriteElementString(
+ ConfigurationSchemaIdentifiers.Orientation,
+ XmlConvert.ToString(structureCalculation.StructureNormalOrientation.Value));
+ }
+
+ if (structureCalculation.HydraulicBoundaryLocationName != null)
+ {
+ writer.WriteElementString(
+ ConfigurationSchemaIdentifiers.HydraulicBoundaryLocationElement,
+ structureCalculation.HydraulicBoundaryLocationName);
+ }
+
+ if (structureCalculation.StructureName != null)
+ {
+ writer.WriteElementString(
+ ConfigurationSchemaIdentifiers.StructureElement,
+ structureCalculation.StructureName);
+ }
+
+ if (structureCalculation.ForeshoreProfileName != null)
+ {
+ writer.WriteElementString(
+ ConfigurationSchemaIdentifiers.ForeshoreProfileNameElement,
+ structureCalculation.ForeshoreProfileName);
+ }
+
+ if (structureCalculation.WaveReduction != null)
+ {
+ writer.WriteWaveReduction(structureCalculation.WaveReduction);
+ }
+
+ writer.WriteStartElement(ConfigurationSchemaIdentifiers.StochastsElement);
+
+ if (structureCalculation.FlowWidthAtBottomProtection != null)
+ {
+ writer.WriteDistribution(ConfigurationSchemaIdentifiers.FlowWidthAtBottomProtectionStochastName, structureCalculation.FlowWidthAtBottomProtection);
+ }
+ if (structureCalculation.WidthFlowApertures != null)
+ {
+ writer.WriteDistribution(ConfigurationSchemaIdentifiers.WidthFlowAperturesStochastName, structureCalculation.WidthFlowApertures);
+ }
+ if (structureCalculation.StorageStructureArea != null)
+ {
+ writer.WriteDistribution(ConfigurationSchemaIdentifiers.StorageStructureAreaStochastName, structureCalculation.StorageStructureArea);
+ }
+ if (structureCalculation.CriticalOvertoppingDischarge != null)
+ {
+ writer.WriteDistribution(ConfigurationSchemaIdentifiers.CriticalOvertoppingDischargeStochastName, structureCalculation.CriticalOvertoppingDischarge);
+ }
+ if (structureCalculation.ModelFactorSuperCriticalFlow != null)
+ {
+ writer.WriteDistribution(ConfigurationSchemaIdentifiers.ModelFactorSuperCriticalFlowStochastName, structureCalculation.ModelFactorSuperCriticalFlow);
+ }
+ if (structureCalculation.AllowedLevelIncreaseStorage != null)
+ {
+ writer.WriteDistribution(ConfigurationSchemaIdentifiers.AllowedLevelIncreaseStorageStochastName, structureCalculation.AllowedLevelIncreaseStorage);
+ }
+ if (structureCalculation.StormDuration != null)
+ {
+ writer.WriteDistribution(ConfigurationSchemaIdentifiers.StormDurationStochastName, structureCalculation.StormDuration);
+ }
+
+ writer.WriteEndElement();
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/StructureCalculationConfigurationTest.cs
===================================================================
diff -u -rf3feb7d017a933271c410470add90ae106745ceb -r4011a127978bb211ddb1101a2c608ed9c991d06d
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/StructureCalculationConfigurationTest.cs (.../StructureCalculationConfigurationTest.cs) (revision f3feb7d017a933271c410470add90ae106745ceb)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/StructureCalculationConfigurationTest.cs (.../StructureCalculationConfigurationTest.cs) (revision 4011a127978bb211ddb1101a2c608ed9c991d06d)
@@ -29,13 +29,26 @@
public class StructureCalculationConfigurationTest
{
[Test]
- public void Constructor_ExpectedValues()
+ public void Constructor_WithoutName_ThrowsArgumentNullException()
{
// Call
- var configuration = new SimpleStructureCalculationConfiguration();
+ TestDelegate call = () => new SimpleStructureCalculationConfiguration(null);
// Assert
- Assert.IsNull(configuration.Name);
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void Constructor_WithName_ExpectedValues()
+ {
+ // Setup
+ var name = "name";
+
+ // Call
+ var configuration = new SimpleStructureCalculationConfiguration(name);
+
+ // Assert
+ Assert.AreEqual(name, configuration.Name);
Assert.IsNull(configuration.ModelFactorSuperCriticalFlow);
Assert.IsNull(configuration.StructureName);
Assert.IsNull(configuration.HydraulicBoundaryLocationName);
@@ -55,9 +68,9 @@
public void SimpleProperties_SetNewValue_GetsNewlySetValue()
{
// Setup
- var configuration = new SimpleStructureCalculationConfiguration();
-
const string configurationName = "some name";
+ var configuration = new SimpleStructureCalculationConfiguration(configurationName);
+
const string structureName = "some structure";
const string hydraulicBoundaryLocationName = "some hydraulic boundary location";
const string foreshoreProfileName = "some foreshore profile";
@@ -110,6 +123,7 @@
public class SimpleStructureCalculationConfiguration : StructureCalculationConfiguration
{
+ public SimpleStructureCalculationConfiguration(string name) : base(name) {}
}
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/XmlWriterExtensionsTest.cs
===================================================================
diff -u -rbd630045ef64f5b7e321021205aae3a4d32f4a5e -r4011a127978bb211ddb1101a2c608ed9c991d06d
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/XmlWriterExtensionsTest.cs (.../XmlWriterExtensionsTest.cs) (revision bd630045ef64f5b7e321021205aae3a4d32f4a5e)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/XmlWriterExtensionsTest.cs (.../XmlWriterExtensionsTest.cs) (revision 4011a127978bb211ddb1101a2c608ed9c991d06d)
@@ -19,13 +19,15 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using Core.Common.TestUtil;
using NUnit.Framework;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.IO.Configurations;
+using Ringtoets.Common.IO.Test.Configurations;
using Ringtoets.Common.IO.Writers;
namespace Ringtoets.Common.IO.Test.Writers
@@ -158,6 +160,68 @@
.SetName("Wave reduction without use foreshore profile set.");
}
+ public static IEnumerable GetStructureCalculations()
+ {
+ yield return new TestCaseData(
+ new SimpleStructureCalculationConfiguration("some name"),
+ "structureCalculationWithoutParametersSet.xml")
+ .SetName("Structure calculation without any of its paramters set.");
+
+ yield return new TestCaseData(
+ new SimpleStructureCalculationConfiguration("some other name")
+ {
+ AllowedLevelIncreaseStorage = new MeanStandardDeviationStochastConfiguration
+ {
+ Mean = 1.2,
+ StandardDeviation = 3.4
+ },
+ CriticalOvertoppingDischarge = new MeanVariationCoefficientStochastConfiguration
+ {
+ Mean = 22.2,
+ VariationCoefficient = 2.1
+ },
+ FailureProbabilityStructureWithErosion = 2.1,
+ FlowWidthAtBottomProtection = new MeanStandardDeviationStochastConfiguration
+ {
+ Mean = 5.4,
+ StandardDeviation = 1.1
+ },
+ ForeshoreProfileName = "Voorland",
+ HydraulicBoundaryLocationName = "Randvoorwaardelocatie",
+ ModelFactorSuperCriticalFlow = new MeanStandardDeviationStochastConfiguration
+ {
+ Mean = 322.2,
+ StandardDeviation = 91.2
+ },
+ StorageStructureArea = new MeanVariationCoefficientStochastConfiguration
+ {
+ Mean = 11.122,
+ VariationCoefficient = 32.111
+ },
+ StormDuration = new MeanVariationCoefficientStochastConfiguration
+ {
+ Mean = 21.22,
+ VariationCoefficient = 1.2
+ },
+ StructureNormalOrientation = 5.6,
+ StructureName = "Kunstwerk",
+ WaveReduction = new WaveReductionConfiguration
+ {
+ BreakWaterType = ReadBreakWaterType.Caisson,
+ UseBreakWater = false,
+ BreakWaterHeight = 111111.2,
+ UseForeshoreProfile = true
+ },
+ WidthFlowApertures = new MeanStandardDeviationStochastConfiguration
+ {
+ Mean = 121.3,
+ StandardDeviation = 222.1
+ }
+ },
+ "structureCalculationWithAllParametersSet.xml")
+ .SetName("Structure calculation with all of its paramters set.");
+ }
+
[Test]
[TestCaseSource(nameof(GetDistributions))]
public void WriteDistribution_WithDifferentSetParameters_WritesStochastWithSetParameters(MeanStandardDeviationStochastConfiguration distribution, string fileName)
@@ -186,6 +250,65 @@
}
[Test]
+ public void WriteDistribution_StandardDeviationDistributionWithoutWriter_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate testDelegate = () => ((XmlWriter)null).WriteDistribution("name", new MeanStandardDeviationStochastConfiguration());
+
+ // Assert
+ var exception = Assert.Throws(testDelegate);
+ Assert.AreEqual("writer", exception.ParamName);
+ }
+
+ [Test]
+ public void WriteDistribution_StandardDeviationDistributionWithoutName_ThrowsArgumentNullException()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath(nameof(WriteDistribution_WithDifferentSetParameters_WritesStochastWithSetParameters));
+
+ try
+ {
+ using (XmlWriter xmlWriter = CreateXmlWriter(filePath))
+ {
+ // Call
+ TestDelegate testDelegate = () => xmlWriter.WriteDistribution(null, new MeanStandardDeviationStochastConfiguration());
+
+ // Assert
+ var exception = Assert.Throws(testDelegate);
+ Assert.AreEqual("name", exception.ParamName);
+ }
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ [Test]
+ public void WriteDistribution_WithoutStandardDeviationDistribution_ThrowsArgumentNullException()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath(nameof(WriteDistribution_WithDifferentSetParameters_WritesStochastWithSetParameters));
+
+ try
+ {
+ using (XmlWriter xmlWriter = CreateXmlWriter(filePath))
+ {
+ // Call
+ TestDelegate testDelegate = () => xmlWriter.WriteDistribution("name", (MeanStandardDeviationStochastConfiguration) null);
+
+ // Assert
+ var exception = Assert.Throws(testDelegate);
+ Assert.AreEqual("distribution", exception.ParamName);
+ }
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ [Test]
[TestCaseSource(nameof(GetVariationCoefficientDistributions))]
public void WriteDistribution_WithDifferentSetParameters_WritesStochastWithSetParameters(MeanVariationCoefficientStochastConfiguration distribution, string fileName)
{
@@ -213,6 +336,65 @@
}
[Test]
+ public void WriteDistribution_VariationCoefficientDistributionWithoutWriter_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate testDelegate = () => ((XmlWriter)null).WriteDistribution("name", new MeanVariationCoefficientStochastConfiguration());
+
+ // Assert
+ var exception = Assert.Throws(testDelegate);
+ Assert.AreEqual("writer", exception.ParamName);
+ }
+
+ [Test]
+ public void WriteDistribution_VariationCoefficientDistributionWithoutName_ThrowsArgumentNullException()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath(nameof(WriteDistribution_WithDifferentSetParameters_WritesStochastWithSetParameters));
+
+ try
+ {
+ using (XmlWriter xmlWriter = CreateXmlWriter(filePath))
+ {
+ // Call
+ TestDelegate testDelegate = () => xmlWriter.WriteDistribution(null, new MeanVariationCoefficientStochastConfiguration());
+
+ // Assert
+ var exception = Assert.Throws(testDelegate);
+ Assert.AreEqual("name", exception.ParamName);
+ }
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ [Test]
+ public void WriteDistribution_WithoutVariationCoefficientDistribution_ThrowsArgumentNullException()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath(nameof(WriteDistribution_WithDifferentSetParameters_WritesStochastWithSetParameters));
+
+ try
+ {
+ using (XmlWriter xmlWriter = CreateXmlWriter(filePath))
+ {
+ // Call
+ TestDelegate testDelegate = () => xmlWriter.WriteDistribution("name", (MeanVariationCoefficientStochastConfiguration)null);
+
+ // Assert
+ var exception = Assert.Throws(testDelegate);
+ Assert.AreEqual("distribution", exception.ParamName);
+ }
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ [Test]
[TestCaseSource(nameof(GetWaveReductions))]
public void WriteWaveReduction_WithoutDifferentSetParameters_WritesStochastWithSetParameters(WaveReductionConfiguration waveReduction, string fileName)
{
@@ -238,6 +420,102 @@
}
}
+ [Test]
+ public void WriteWaveReduction_WithoutWriter_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate testDelegate = () => ((XmlWriter)null).WriteWaveReduction(new WaveReductionConfiguration());
+
+ // Assert
+ var exception = Assert.Throws(testDelegate);
+ Assert.AreEqual("writer", exception.ParamName);
+ }
+
+ [Test]
+ public void WriteWaveReduction_WithoutWaveReduction_ThrowsArgumentNullException()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath(nameof(WriteDistribution_WithDifferentSetParameters_WritesStochastWithSetParameters));
+
+ try
+ {
+ using (XmlWriter xmlWriter = CreateXmlWriter(filePath))
+ {
+ // Call
+ TestDelegate testDelegate = () => xmlWriter.WriteWaveReduction(null);
+
+ // Assert
+ var exception = Assert.Throws(testDelegate);
+ Assert.AreEqual("waveReduction", exception.ParamName);
+ }
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ [Test]
+ [TestCaseSource(nameof(GetStructureCalculations))]
+ public void WriteCommonStructureProperties_WithoutDifferentSetParameters_WritesSetStructureProperties(StructureCalculationConfiguration structureCalculation, string fileName)
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath(nameof(WriteCommonStructureProperties_WithoutDifferentSetParameters_WritesSetStructureProperties));
+
+ try
+ {
+ using (XmlWriter xmlWriter = CreateXmlWriter(filePath))
+ {
+ // Call
+ xmlWriter.WriteStartCommonStructureProperties(structureCalculation);
+ }
+
+ // Assert
+ string actualXml = File.ReadAllText(filePath);
+ string expectedXml = GetTestFileContent(fileName);
+ Assert.AreEqual(expectedXml, actualXml);
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ [Test]
+ public void WriteCommonStructureProperties_WithoutWriter_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate testDelegate = () => ((XmlWriter)null).WriteStartCommonStructureProperties(new SimpleStructureCalculationConfiguration(""));
+
+ // Assert
+ var exception = Assert.Throws(testDelegate);
+ Assert.AreEqual("writer", exception.ParamName);
+ }
+
+ [Test]
+ public void WriteCommonStructureProperties_WithoutStructureCalculation_ThrowsArgumentNullException()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath(nameof(WriteCommonStructureProperties_WithoutDifferentSetParameters_WritesSetStructureProperties));
+
+ try
+ {
+ using (XmlWriter xmlWriter = CreateXmlWriter(filePath))
+ {
+ // Call
+ TestDelegate testDelegate = () => xmlWriter.WriteStartCommonStructureProperties(null);
+
+ // Assert
+ var exception = Assert.Throws(testDelegate);
+ Assert.AreEqual("structureCalculation", exception.ParamName);
+ }
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
private string GetTestFileContent(string testFile)
{
return File.ReadAllText(Path.Combine(testDirectory, testFile));
@@ -252,4 +530,9 @@
});
}
}
+
+ public class SimpleStructureCalculationConfiguration : StructureCalculationConfiguration
+ {
+ public SimpleStructureCalculationConfiguration(string name) : base(name) {}
+ }
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/structureCalculationWithAllParametersSet.xml
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/structureCalculationWithAllParametersSet.xml (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/structureCalculationWithAllParametersSet.xml (revision 4011a127978bb211ddb1101a2c608ed9c991d06d)
@@ -0,0 +1,43 @@
+
+ 2.1
+ 5.6
+ Randvoorwaardelocatie
+ Kunstwerk
+ Voorland
+
+ false
+ caisson
+ 111111.2
+ true
+
+
+
+ 5.4
+ 1.1
+
+
+ 121.3
+ 222.1
+
+
+ 11.122
+ 32.111
+
+
+ 22.2
+ 2.1
+
+
+ 322.2
+ 91.2
+
+
+ 1.2
+ 3.4
+
+
+ 21.22
+ 1.2
+
+
+
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/structureCalculationWithoutParametersSet.xml
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/structureCalculationWithoutParametersSet.xml (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/structureCalculationWithoutParametersSet.xml (revision 4011a127978bb211ddb1101a2c608ed9c991d06d)
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file