Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/WaveConditions/ExportableWaveConditionsFactory.cs
===================================================================
diff -u -r0590c2c613c7295ef616fce95fefcdaf87967331 -r72d895dda23b767299d42560e7760c4b689f3c69
--- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/WaveConditions/ExportableWaveConditionsFactory.cs (.../ExportableWaveConditionsFactory.cs) (revision 0590c2c613c7295ef616fce95fefcdaf87967331)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/WaveConditions/ExportableWaveConditionsFactory.cs (.../ExportableWaveConditionsFactory.cs) (revision 72d895dda23b767299d42560e7760c4b689f3c69)
@@ -88,7 +88,7 @@
/// Create a collection of .
///
/// The name of the calculation to which the objects belong.
- /// The used in the calculations.
+ /// The used in the calculations.
/// The objects resulting from the calculations.
/// The type of cover.
/// A container of objects.
@@ -97,40 +97,20 @@
/// - any parameter is null
/// - any item in is null
///
- /// Thrown when
+ /// Thrown when
/// is null for .
public static IEnumerable CreateExportableWaveConditionsCollection(
- string name, WaveConditionsInput waveConditionsInput,
+ string name, FailureMechanismCategoryWaveConditionsInput waveConditionsInput,
IEnumerable output, CoverType coverType)
{
- if (name == null)
- {
- throw new ArgumentNullException(nameof(name));
- }
-
- if (waveConditionsInput == null)
- {
- throw new ArgumentNullException(nameof(waveConditionsInput));
- }
-
- if (output == null)
- {
- throw new ArgumentNullException(nameof(output));
- }
-
- if (coverType == null)
- {
- throw new ArgumentNullException(nameof(coverType));
- }
-
- return output.Select(waveConditionsOutput => new ExportableWaveConditions(name, waveConditionsInput, waveConditionsOutput, coverType)).ToArray();
+ return CreateExportableWaveConditionsCollection(name, (WaveConditionsInput) waveConditionsInput, output, coverType);
}
///
/// Create a collection of .
///
/// The name of the calculation to which the objects belong.
- /// The used in the calculations.
+ /// The used in the calculations.
/// The objects resulting from the calculations.
/// The type of cover.
/// A container of objects.
@@ -139,40 +119,20 @@
/// - any parameter is null
/// - any item in is null
///
- /// Thrown when
+ /// Thrown when
/// is null for .
public static IEnumerable CreateExportableWaveConditionsCollection(
- string name, FailureMechanismCategoryWaveConditionsInput waveConditionsInput,
+ string name, AssessmentSectionCategoryWaveConditionsInput waveConditionsInput,
IEnumerable output, CoverType coverType)
{
- if (name == null)
- {
- throw new ArgumentNullException(nameof(name));
- }
-
- if (waveConditionsInput == null)
- {
- throw new ArgumentNullException(nameof(waveConditionsInput));
- }
-
- if (output == null)
- {
- throw new ArgumentNullException(nameof(output));
- }
-
- if (coverType == null)
- {
- throw new ArgumentNullException(nameof(coverType));
- }
-
- return output.Select(waveConditionsOutput => new ExportableWaveConditions(name, waveConditionsInput, waveConditionsOutput, coverType)).ToArray();
+ return CreateExportableWaveConditionsCollection(name, (WaveConditionsInput) waveConditionsInput, output, coverType);
}
///
/// Create a collection of .
///
/// The name of the calculation to which the objects belong.
- /// The used in the calculations.
+ /// The used in the calculations.
/// The objects resulting from the calculations.
/// The type of cover.
/// A container of objects.
@@ -181,10 +141,10 @@
/// - any parameter is null
/// - any item in is null
///
- /// Thrown when
+ /// Thrown when
/// is null for .
- public static IEnumerable CreateExportableWaveConditionsCollection(
- string name, AssessmentSectionCategoryWaveConditionsInput waveConditionsInput,
+ private static IEnumerable CreateExportableWaveConditionsCollection(
+ string name, WaveConditionsInput waveConditionsInput,
IEnumerable output, CoverType coverType)
{
if (name == null)
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/ExportableWaveConditionsFactoryTest.cs
===================================================================
diff -u -r0590c2c613c7295ef616fce95fefcdaf87967331 -r72d895dda23b767299d42560e7760c4b689f3c69
--- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/ExportableWaveConditionsFactoryTest.cs (.../ExportableWaveConditionsFactoryTest.cs) (revision 0590c2c613c7295ef616fce95fefcdaf87967331)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/WaveConditions/ExportableWaveConditionsFactoryTest.cs (.../ExportableWaveConditionsFactoryTest.cs) (revision 72d895dda23b767299d42560e7760c4b689f3c69)
@@ -90,7 +90,7 @@
TestDelegate call = () => ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection("aName",
new TestWaveConditionsInput(),
waveConditionsOutputCollection,
- (IEnumerable) null);
+ null);
// Assert
var exception = Assert.Throws(call);
@@ -155,102 +155,6 @@
}
[Test]
- public void CreateExportableWaveConditionsCollectionWithCoverType_NameNull_ThrowArgumentNullException()
- {
- // Call
- TestDelegate call = () => ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection(null,
- new TestWaveConditionsInput(),
- waveConditionsOutputCollection,
- CoverType.Asphalt);
-
- // Assert
- var exception = Assert.Throws(call);
- Assert.AreEqual("name", exception.ParamName);
- }
-
- [Test]
- public void CreateExportableWaveConditionsCollectionWithCoverType_WaveConditionsInputNull_ThrowArgumentNullException()
- {
- // Call
- TestDelegate call = () => ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection("aName",
- (WaveConditionsInput) null,
- waveConditionsOutputCollection,
- CoverType.Asphalt);
-
- // Assert
- var exception = Assert.Throws(call);
- Assert.AreEqual("waveConditionsInput", exception.ParamName);
- }
-
- [Test]
- public void CreateExportableWaveConditionsCollectionWithCoverType_OutputNull_ThrowArgumentNullException()
- {
- // Call
- TestDelegate call = () => ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection("aName",
- new TestWaveConditionsInput(),
- null,
- CoverType.Asphalt);
-
- // Assert
- var exception = Assert.Throws(call);
- Assert.AreEqual("output", exception.ParamName);
- }
-
- [Test]
- public void CreateExportableWaveConditionsCollectionWithCoverType_CoverTypeNull_ThrowArgumentNullException()
- {
- // Call
- TestDelegate call = () => ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection("aName",
- new TestWaveConditionsInput(),
- Enumerable.Empty(),
- (CoverType) null);
-
- // Assert
- var exception = Assert.Throws(call);
- Assert.AreEqual("coverType", exception.ParamName);
- }
-
- [Test]
- public void CreateExportableWaveConditionsCollectionWithCoverType_ValidDataWithCoverType_ReturnsValidCollection()
- {
- // Setup
- var waveConditionsInput = new TestWaveConditionsInput
- {
- HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "hblName", 1.0, 8.0),
- ForeshoreProfile = new TestForeshoreProfile(),
- UseForeshore = true
- };
-
- // Call
- ExportableWaveConditions[] exportableWaveConditionsCollection =
- ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection("ewcName",
- waveConditionsInput,
- waveConditionsOutputCollection,
- CoverType.Grass).ToArray();
-
- // Assert
- Assert.AreEqual(1, exportableWaveConditionsCollection.Length);
- ExportableWaveConditions exportableWaveConditions = exportableWaveConditionsCollection[0];
- Assert.AreEqual("ewcName", exportableWaveConditions.CalculationName);
- Assert.AreEqual("hblName", exportableWaveConditions.LocationName);
- Assert.AreEqual(1.0, exportableWaveConditions.LocationXCoordinate);
- Assert.AreEqual(8.0, exportableWaveConditions.LocationYCoordinate);
- Assert.AreEqual("id", exportableWaveConditions.ForeshoreId);
- Assert.AreEqual(false, exportableWaveConditions.UseBreakWater);
- Assert.AreEqual(true, exportableWaveConditions.UseForeshore);
- Assert.AreEqual(CoverType.Grass, exportableWaveConditions.CoverType);
- Assert.AreEqual(2, exportableWaveConditions.WaterLevel.NumberOfDecimalPlaces);
- Assert.AreEqual(2, exportableWaveConditions.WaveHeight.NumberOfDecimalPlaces);
- Assert.AreEqual(2, exportableWaveConditions.WavePeriod.NumberOfDecimalPlaces);
- Assert.AreEqual(2, exportableWaveConditions.WaveAngle.NumberOfDecimalPlaces);
- Assert.AreEqual(waveConditionsOutput.WaterLevel, exportableWaveConditions.WaterLevel);
- Assert.AreEqual(waveConditionsOutput.WaveHeight, exportableWaveConditions.WaveHeight);
- Assert.AreEqual(waveConditionsOutput.WavePeakPeriod, exportableWaveConditions.WavePeriod);
- Assert.AreEqual(waveConditionsOutput.WaveAngle, exportableWaveConditions.WaveAngle);
- Assert.AreEqual(waveConditionsOutput.WaveDirection, exportableWaveConditions.WaveDirection);
- }
-
- [Test]
public void CreateExportableWaveConditionsCollectionWithFailureMechanismCategoryWaveConditionsInput_NameNull_ThrowArgumentNullException()
{
// Call
@@ -269,7 +173,7 @@
{
// Call
TestDelegate call = () => ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection("aName",
- (WaveConditionsInput) null,
+ (FailureMechanismCategoryWaveConditionsInput) null,
waveConditionsOutputCollection,
CoverType.Asphalt);
@@ -299,7 +203,7 @@
TestDelegate call = () => ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection("aName",
new FailureMechanismCategoryWaveConditionsInput(),
Enumerable.Empty(),
- (CoverType) null);
+ null);
// Assert
var exception = Assert.Throws(call);
@@ -395,7 +299,7 @@
TestDelegate call = () => ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection("aName",
new AssessmentSectionCategoryWaveConditionsInput(),
Enumerable.Empty(),
- (CoverType) null);
+ null);
// Assert
var exception = Assert.Throws(call);