Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsInput.cs
===================================================================
diff -u -rcc8b9d8e93577a236afec4dd16a25f89996241fa -r4272fbc8be7c5932b0caeaf32ab5c11a4fb21bf7
--- Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsInput.cs (.../WaveConditionsInput.cs) (revision cc8b9d8e93577a236afec4dd16a25f89996241fa)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsInput.cs (.../WaveConditionsInput.cs) (revision 4272fbc8be7c5932b0caeaf32ab5c11a4fb21bf7)
@@ -117,7 +117,7 @@
RoundedDouble newOrientation = value.ToPrecision(orientation.NumberOfDecimalPlaces);
if (!double.IsNaN(newOrientation) && !orientationValidityRange.InRange(newOrientation))
{
- throw new ArgumentOutOfRangeException(nameof(value), string.Format(RingtoetsCommonDataResources.Orientation_Value_needs_to_be_in_Range_0_,
+ throw new ArgumentOutOfRangeException(null, string.Format(RingtoetsCommonDataResources.Orientation_Value_needs_to_be_in_Range_0_,
orientationValidityRange));
}
orientation = newOrientation;
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Importers/WaveConditionsCalculationConfigurationImporter.cs
===================================================================
diff -u -rf63a76d0b9b432f146d9b6e6b67e5bf65963f66e -r4272fbc8be7c5932b0caeaf32ab5c11a4fb21bf7
--- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Importers/WaveConditionsCalculationConfigurationImporter.cs (.../WaveConditionsCalculationConfigurationImporter.cs) (revision f63a76d0b9b432f146d9b6e6b67e5bf65963f66e)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Importers/WaveConditionsCalculationConfigurationImporter.cs (.../WaveConditionsCalculationConfigurationImporter.cs) (revision 4272fbc8be7c5932b0caeaf32ab5c11a4fb21bf7)
@@ -84,6 +84,7 @@
ReadHydraulicBoundaryLocation(readCalculation, waveConditionsCalculation);
ReadBoundaries(readCalculation, waveConditionsCalculation);
ReadStepSize(readCalculation, waveConditionsCalculation);
+ ReadOrientation(readCalculation, waveConditionsCalculation);
return waveConditionsCalculation;
}
@@ -120,12 +121,7 @@
/// Thrown when one of the boundaries is invalid.
private static void ReadBoundaries(ReadWaveConditionsCalculation readCalculation, IWaveConditionsCalculation calculation)
{
- bool hasUpperBoundaryRevetment = readCalculation.UpperBoundaryRevetment.HasValue;
- bool hasLowerBoundaryRevetment = readCalculation.LowerBoundaryRevetment.HasValue;
- bool hasUpperBoundaryWaterLevels = readCalculation.UpperBoundaryWaterLevels.HasValue;
- bool hasLowerBoundaryWaterLevels = readCalculation.LowerBoundaryWaterLevels.HasValue;
-
- if (hasUpperBoundaryRevetment)
+ if (readCalculation.UpperBoundaryRevetment.HasValue)
{
var upperBoundaryRevetment = (double) readCalculation.UpperBoundaryRevetment;
@@ -134,7 +130,7 @@
string.Format(Resources.WaveConditionsCalculationConfigurationImporter_ReadBoundaries_Upper_boundary_revetment_0_invalid, upperBoundaryRevetment));
}
- if (hasLowerBoundaryRevetment)
+ if (readCalculation.LowerBoundaryRevetment.HasValue)
{
var lowerBoundaryRevetment = (double) readCalculation.LowerBoundaryRevetment;
@@ -143,7 +139,7 @@
string.Format(Resources.WaveConditionsCalculationConfigurationImporter_ReadBoundaries_Lower_boundary_revetment_0_invalid, lowerBoundaryRevetment));
}
- if (hasUpperBoundaryWaterLevels)
+ if (readCalculation.UpperBoundaryWaterLevels.HasValue)
{
var upperBoundaryWaterLevels = (double) readCalculation.UpperBoundaryWaterLevels;
@@ -152,7 +148,7 @@
string.Format(Resources.WaveConditionsCalculationConfigurationImporter_ReadBoundaries_Upper_boundary_waterlevels_0_invalid, upperBoundaryWaterLevels));
}
- if (hasLowerBoundaryWaterLevels)
+ if (readCalculation.LowerBoundaryWaterLevels.HasValue)
{
var lowerBoundaryWaterLevels = (double) readCalculation.LowerBoundaryWaterLevels;
@@ -169,5 +165,17 @@
calculation.InputParameters.StepSize = (WaveConditionsInputStepSize) waveConditionsInputStepSizeConverter.ConvertFrom(readCalculation.StepSize.ToString());
}
}
+
+ private static void ReadOrientation(ReadWaveConditionsCalculation readCalculation, IWaveConditionsCalculation calculation)
+ {
+ if (readCalculation.Orientation.HasValue)
+ {
+ var orientation = (double) readCalculation.Orientation;
+
+ PerformActionHandlingAnyArgumentOutOfRangeException(
+ () => calculation.InputParameters.Orientation = (RoundedDouble) orientation,
+ string.Format(Resources.WaveConditionsCalculationConfigurationImporter_ReadOrientation_Orientation_0_invalid, orientation));
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Properties/Resources.Designer.cs
===================================================================
diff -u -rcc8b9d8e93577a236afec4dd16a25f89996241fa -r4272fbc8be7c5932b0caeaf32ab5c11a4fb21bf7
--- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision cc8b9d8e93577a236afec4dd16a25f89996241fa)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 4272fbc8be7c5932b0caeaf32ab5c11a4fb21bf7)
@@ -1,25 +1,4 @@
-// Copyright (C) Stichting Deltares 2016. 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.
-
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
@@ -187,6 +166,16 @@
}
///
+ /// Looks up a localized string similar to Een waarde van '{0}' als oriëntatie is ongeldig..
+ ///
+ internal static string WaveConditionsCalculationConfigurationImporter_ReadOrientation_Orientation_0_invalid {
+ get {
+ return ResourceManager.GetString("WaveConditionsCalculationConfigurationImporter_ReadOrientation_Orientation_0_inva" +
+ "lid", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to {0} Er zijn geen golfrandvoorwaarden geëxporteerd..
///
internal static string WaveConditionsExporter_Error_Exception_0_no_WaveConditions_exported {
Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Properties/Resources.resx
===================================================================
diff -u -rcc8b9d8e93577a236afec4dd16a25f89996241fa -r4272fbc8be7c5932b0caeaf32ab5c11a4fb21bf7
--- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Properties/Resources.resx (.../Resources.resx) (revision cc8b9d8e93577a236afec4dd16a25f89996241fa)
+++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Properties/Resources.resx (.../Resources.resx) (revision 4272fbc8be7c5932b0caeaf32ab5c11a4fb21bf7)
@@ -157,4 +157,7 @@
Een waarde van '{0}' als ondergrens van de rekenreeks is ongeldig.
+
+ Een waarde van '{0}' als oriëntatie is ongeldig.
+
\ No newline at end of file
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Importers/WaveConditionsCalculationConfigurationImporterTest.cs
===================================================================
diff -u -rf63a76d0b9b432f146d9b6e6b67e5bf65963f66e -r4272fbc8be7c5932b0caeaf32ab5c11a4fb21bf7
--- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Importers/WaveConditionsCalculationConfigurationImporterTest.cs (.../WaveConditionsCalculationConfigurationImporterTest.cs) (revision f63a76d0b9b432f146d9b6e6b67e5bf65963f66e)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Importers/WaveConditionsCalculationConfigurationImporterTest.cs (.../WaveConditionsCalculationConfigurationImporterTest.cs) (revision 4272fbc8be7c5932b0caeaf32ab5c11a4fb21bf7)
@@ -74,6 +74,8 @@
"Een waarde van '2,2' als ondergrens bekledingen is ongeldig. De bovengrens van de bekleding moet boven de ondergrens liggen.")]
[TestCase("validConfigurationInvalidWaterLevelBoundaries.xml",
"Een waarde van '2,2' als ondergrens van de rekenreeks is ongeldig. De bovengrens van de rekenreeks moet boven de ondergrens liggen.")]
+ [TestCase("validConfigurationInvalidOrientation.xml",
+ "Een waarde van '380' als oriëntatie is ongeldig. De waarde voor de oriëntatie moet in het bereik [0,00, 360,00] liggen.")]
public void Import_ValidConfigurationInvalidData_LogMessageAndContinueImport(string file, string expectedErrorMessage)
{
// Setup
@@ -151,7 +153,8 @@
LowerBoundaryRevetment = (RoundedDouble) 2,
UpperBoundaryWaterLevels = (RoundedDouble) 9,
LowerBoundaryWaterLevels = (RoundedDouble) 4,
- StepSize = WaveConditionsInputStepSize.Half
+ StepSize = WaveConditionsInputStepSize.Half,
+ Orientation = (RoundedDouble) 5.5
}
};
@@ -168,6 +171,7 @@
Assert.AreEqual(expectedCalculation.InputParameters.UpperBoundaryWaterLevels, actualCalculation.InputParameters.UpperBoundaryWaterLevels);
Assert.AreEqual(expectedCalculation.InputParameters.LowerBoundaryWaterLevels, actualCalculation.InputParameters.LowerBoundaryWaterLevels);
Assert.AreEqual(expectedCalculation.InputParameters.StepSize, actualCalculation.InputParameters.StepSize);
+ Assert.AreEqual(expectedCalculation.InputParameters.Orientation, actualCalculation.InputParameters.Orientation);
}
private class SimpleWaveConditionsCalculation : Observable, IWaveConditionsCalculation