Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/ConfigurationStabilityPointStructuresInflowModelTypeConverter.cs
===================================================================
diff -u -r306d53c7436437d23464f9d0bf104fe699eb7e3f -r3a0181621fb32832a78d734a6ece4cc4a3a3e683
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/ConfigurationStabilityPointStructuresInflowModelTypeConverter.cs (.../ConfigurationStabilityPointStructuresInflowModelTypeConverter.cs) (revision 306d53c7436437d23464f9d0bf104fe699eb7e3f)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/ConfigurationStabilityPointStructuresInflowModelTypeConverter.cs (.../ConfigurationStabilityPointStructuresInflowModelTypeConverter.cs) (revision 3a0181621fb32832a78d734a6ece4cc4a3a3e683)
@@ -89,7 +89,7 @@
/// The to convert.
/// The converted .
/// Thrown when is not supported.
- private static object ConvertToStabilityPointStructureInflowModelType(ConfigurationStabilityPointStructuresInflowModelType type)
+ private static StabilityPointStructureInflowModelType ConvertToStabilityPointStructureInflowModelType(ConfigurationStabilityPointStructuresInflowModelType type)
{
switch (type)
{
@@ -108,7 +108,7 @@
/// The to convert.
/// The converted .
/// Thrown when is not supported.
- private static object ConvertToString(ConfigurationStabilityPointStructuresInflowModelType type)
+ private static string ConvertToString(ConfigurationStabilityPointStructuresInflowModelType type)
{
switch (type)
{
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/ConfigurationStabilityPointStructuresLoadSchematizationType.cs
===================================================================
diff -u
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/ConfigurationStabilityPointStructuresLoadSchematizationType.cs (revision 0)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/ConfigurationStabilityPointStructuresLoadSchematizationType.cs (revision 3a0181621fb32832a78d734a6ece4cc4a3a3e683)
@@ -0,0 +1,42 @@
+// 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.
+
+using Ringtoets.StabilityPointStructures.Data;
+
+namespace Ringtoets.StabilityPointStructures.IO
+{
+ ///
+ /// Defines the types of load representations that can be used
+ /// for the schematization of .
+ ///
+ public enum ConfigurationStabilityPointStructuresLoadSchematizationType
+ {
+ ///
+ /// A linear schematization.
+ ///
+ Linear = 1,
+
+ ///
+ /// A quadratic schematization.
+ ///
+ Quadratic = 2
+ }
+}
\ No newline at end of file
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter.cs
===================================================================
diff -u
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter.cs (revision 0)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter.cs (revision 3a0181621fb32832a78d734a6ece4cc4a3a3e683)
@@ -0,0 +1,164 @@
+// 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.
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using Ringtoets.StabilityPointStructures.Data;
+
+namespace Ringtoets.StabilityPointStructures.IO
+{
+ ///
+ /// Converts to
+ /// or and back.
+ ///
+ public class ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter : TypeConverter
+ {
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
+ {
+ if (destinationType == typeof(LoadSchematizationType))
+ {
+ return true;
+ }
+ return base.CanConvertTo(context, destinationType);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ var type = (ConfigurationStabilityPointStructuresLoadSchematizationType) value;
+ if (destinationType == typeof(string))
+ {
+ return ConvertToString(type);
+ }
+ if (destinationType == typeof(LoadSchematizationType))
+ {
+ return ConvertToLoadSchematizationType(type);
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ if (sourceType == typeof(string))
+ {
+ return true;
+ }
+ if (sourceType == typeof(LoadSchematizationType))
+ {
+ return true;
+ }
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ var text = value as string;
+ if (text != null)
+ {
+ return ConvertToConfigurationStabilityPointStructuresLoadSchematizationType(text);
+ }
+ var loadSchematizationType = value as LoadSchematizationType?;
+ if (loadSchematizationType != null)
+ {
+ return ConvertToConfigurationStabilityPointStructuresLoadSchematizationType(loadSchematizationType.Value);
+ }
+ return base.ConvertFrom(context, culture, value);
+ }
+
+ ///
+ /// Converts to .
+ ///
+ /// The to convert.
+ /// The converted .
+ /// Thrown when is not supported.
+ private static ConfigurationStabilityPointStructuresLoadSchematizationType ConvertToConfigurationStabilityPointStructuresLoadSchematizationType(
+ LoadSchematizationType loadSchematizationType)
+ {
+ switch (loadSchematizationType)
+ {
+ case LoadSchematizationType.Linear:
+ return ConfigurationStabilityPointStructuresLoadSchematizationType.Linear;
+ case LoadSchematizationType.Quadratic:
+ return ConfigurationStabilityPointStructuresLoadSchematizationType.Quadratic;
+ default:
+ throw new NotSupportedException($"Value '{loadSchematizationType}' is not supported.");
+ }
+ }
+
+ ///
+ /// Converts to .
+ ///
+ /// The to convert.
+ /// The converted .
+ /// Thrown when is not supported.
+ private static ConfigurationStabilityPointStructuresLoadSchematizationType ConvertToConfigurationStabilityPointStructuresLoadSchematizationType(
+ string text)
+ {
+ switch (text)
+ {
+ case StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationLinearStructure:
+ return ConfigurationStabilityPointStructuresLoadSchematizationType.Linear;
+ case StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationQuadraticStructure:
+ return ConfigurationStabilityPointStructuresLoadSchematizationType.Quadratic;
+ default:
+ throw new NotSupportedException($"Value '{text}' is not supported.");
+ }
+ }
+
+ ///
+ /// Converts the given to a .
+ ///
+ /// The to convert.
+ /// The converted .
+ /// Thrown when is not supported.
+ private static LoadSchematizationType ConvertToLoadSchematizationType(ConfigurationStabilityPointStructuresLoadSchematizationType type)
+ {
+ switch (type)
+ {
+ case ConfigurationStabilityPointStructuresLoadSchematizationType.Linear:
+ return LoadSchematizationType.Linear;
+ case ConfigurationStabilityPointStructuresLoadSchematizationType.Quadratic:
+ return LoadSchematizationType.Quadratic;
+ default:
+ throw new NotSupportedException($"Value '{type}' is not supported.");
+ }
+ }
+
+ ///
+ /// Converts the given to a .
+ ///
+ /// The to convert.
+ /// The converted .
+ /// Thrown when is not supported.
+ private static string ConvertToString(ConfigurationStabilityPointStructuresLoadSchematizationType type)
+ {
+ switch (type)
+ {
+ case ConfigurationStabilityPointStructuresLoadSchematizationType.Linear:
+ return StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationLinearStructure;
+ case ConfigurationStabilityPointStructuresLoadSchematizationType.Quadratic:
+ return StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationQuadraticStructure;
+ default:
+ throw new NotSupportedException($"Value '{type}' is not supported.");
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Ringtoets.StabilityPointStructures.IO.csproj
===================================================================
diff -u -r306d53c7436437d23464f9d0bf104fe699eb7e3f -r3a0181621fb32832a78d734a6ece4cc4a3a3e683
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Ringtoets.StabilityPointStructures.IO.csproj (.../Ringtoets.StabilityPointStructures.IO.csproj) (revision 306d53c7436437d23464f9d0bf104fe699eb7e3f)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/Ringtoets.StabilityPointStructures.IO.csproj (.../Ringtoets.StabilityPointStructures.IO.csproj) (revision 3a0181621fb32832a78d734a6ece4cc4a3a3e683)
@@ -46,6 +46,8 @@
+
+
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/StabilityPointStructuresCalculationConfiguration.cs
===================================================================
diff -u -r306d53c7436437d23464f9d0bf104fe699eb7e3f -r3a0181621fb32832a78d734a6ece4cc4a3a3e683
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/StabilityPointStructuresCalculationConfiguration.cs (.../StabilityPointStructuresCalculationConfiguration.cs) (revision 306d53c7436437d23464f9d0bf104fe699eb7e3f)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/StabilityPointStructuresCalculationConfiguration.cs (.../StabilityPointStructuresCalculationConfiguration.cs) (revision 3a0181621fb32832a78d734a6ece4cc4a3a3e683)
@@ -107,6 +107,11 @@
public int? LevellingCount { get; set; }
///
+ /// Gets or sets the load schematization type of the structure.
+ ///
+ public ConfigurationStabilityPointStructuresLoadSchematizationType? LoadSchematizationType { get; set; }
+
+ ///
/// Gets or sets the probability of a secondary collision on the structure per leveling.
///
public double? ProbabilityCollisionSecondaryStructure { get; set; }
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/StabilityPointStructuresConfigurationSchemaIdentifiers.cs
===================================================================
diff -u -re37e45f2e21aa0bf7cb46da85878c18cc2586efe -r3a0181621fb32832a78d734a6ece4cc4a3a3e683
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/StabilityPointStructuresConfigurationSchemaIdentifiers.cs (.../StabilityPointStructuresConfigurationSchemaIdentifiers.cs) (revision e37e45f2e21aa0bf7cb46da85878c18cc2586efe)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.IO/StabilityPointStructuresConfigurationSchemaIdentifiers.cs (.../StabilityPointStructuresConfigurationSchemaIdentifiers.cs) (revision 3a0181621fb32832a78d734a6ece4cc4a3a3e683)
@@ -19,8 +19,6 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using Ringtoets.StabilityPointStructures.Data;
-
namespace Ringtoets.StabilityPointStructures.IO
{
///
@@ -79,13 +77,13 @@
public const string InflowModelTypeElement = "instroommodel";
///
- /// The possible content of the element indicating a
+ /// The possible content of the element indicating a
/// low sill structure.
///
public const string InflowModelLowSillStructure = "lagedrempel";
///
- /// The possible content of the element indicating a
+ /// The possible content of the element indicating a
/// flooded culvert structure.
///
public const string InflowModelFloodedCulvertStructure = "verdronkenkoker";
@@ -111,6 +109,23 @@
public const string LevellingCountElement = "nrnivelleringen";
///
+ /// The identifier for the load schematization type elements.
+ ///
+ public const string LoadSchematizationTypeElement = "belastingschematisering";
+
+ ///
+ /// The possible content of the
+ /// element indicating a linear schematization.
+ ///
+ public const string LoadSchematizationLinearStructure = "lineair";
+
+ ///
+ /// The possible content of the
+ /// element indicating a quadratic schematization.
+ ///
+ public const string LoadSchematizationQuadraticStructure = "kwadratisch";
+
+ ///
/// The identifier for the probability of a secondary collision on the structure per leveling elements.
///
public const string ProbabilityCollisionSecondaryStructureElement = "kansaanvaringtweedekeermiddel";
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/ConfigurationStabilityPointStructuresLoadSchematizationTypeConverterTest.cs
===================================================================
diff -u
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/ConfigurationStabilityPointStructuresLoadSchematizationTypeConverterTest.cs (revision 0)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/ConfigurationStabilityPointStructuresLoadSchematizationTypeConverterTest.cs (revision 3a0181621fb32832a78d734a6ece4cc4a3a3e683)
@@ -0,0 +1,273 @@
+// 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.
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using NUnit.Framework;
+using Ringtoets.StabilityPointStructures.Data;
+
+namespace Ringtoets.StabilityPointStructures.IO.Test
+{
+ [TestFixture]
+ public class ConfigurationStabilityPointStructuresConfigurationStabilityPointStructuresLoadSchematizationTypeConverterTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+
+ // Assert
+ Assert.IsInstanceOf(converter);
+ }
+
+ [Test]
+ public void CanConvertTo_String_ReturnTrue()
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+
+ // Call
+ bool canConvertToString = converter.CanConvertTo(typeof(string));
+
+ // Assert
+ Assert.IsTrue(canConvertToString);
+ }
+
+ [Test]
+ public void CanConvertTo_LoadSchematizationType_ReturnTrue()
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+
+ // Call
+ bool canConvertToString = converter.CanConvertTo(typeof(LoadSchematizationType));
+
+ // Assert
+ Assert.IsTrue(canConvertToString);
+ }
+
+ [Test]
+ public void CanConvertTo_OtherTypeThanStringOrLoadSchematizationType_ReturnFalse()
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+
+ // Call
+ bool canConvertToNonString = converter.CanConvertTo(typeof(object));
+
+ // Assert
+ Assert.IsFalse(canConvertToNonString);
+ }
+
+ [Test]
+ [TestCase(ConfigurationStabilityPointStructuresLoadSchematizationType.Linear, StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationLinearStructure)]
+ [TestCase(ConfigurationStabilityPointStructuresLoadSchematizationType.Quadratic, StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationQuadraticStructure)]
+ public void ConvertTo_ForAllEnumValues_ReturnExpectedText(ConfigurationStabilityPointStructuresLoadSchematizationType value,
+ string expectedText)
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+
+ // Call
+ object result = converter.ConvertTo(null, CultureInfo.CurrentCulture, value, typeof(string));
+
+ // Assert
+ Assert.AreEqual(expectedText, result);
+ }
+
+ [Test]
+ public void ConvertTo_InvalidType_ThrowNotSupportedException()
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+ const ConfigurationStabilityPointStructuresLoadSchematizationType invalidValue = (ConfigurationStabilityPointStructuresLoadSchematizationType) 99999;
+
+ // Call
+ TestDelegate call = () => converter.ConvertTo(invalidValue, typeof(object));
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void ConvertTo_ConfigurationStabilityPointStructuresLoadSchematizationTypeToString_ThrowNotSupportedException()
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+ const ConfigurationStabilityPointStructuresLoadSchematizationType invalidValue = (ConfigurationStabilityPointStructuresLoadSchematizationType) 99999;
+
+ // Call
+ TestDelegate call = () => converter.ConvertTo(invalidValue, typeof(string));
+
+ // Assert
+ string message = Assert.Throws(call).Message;
+ Assert.AreEqual($"Value '{invalidValue}' is not supported.", message);
+ }
+
+ [Test]
+ public void ConvertTo_InvalidConfigurationStabilityPointStructuresLoadSchematizationTypeToLoadSchematizationType_ThrowNotSupportedException()
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+ const ConfigurationStabilityPointStructuresLoadSchematizationType invalidValue = (ConfigurationStabilityPointStructuresLoadSchematizationType) 99999;
+
+ // Call
+ TestDelegate call = () => converter.ConvertTo(invalidValue, typeof(LoadSchematizationType));
+
+ // Assert
+ string message = Assert.Throws(call).Message;
+ Assert.AreEqual($"Value '{invalidValue}' is not supported.", message);
+ }
+
+ [Test]
+ [TestCase(ConfigurationStabilityPointStructuresLoadSchematizationType.Linear, LoadSchematizationType.Linear)]
+ [TestCase(ConfigurationStabilityPointStructuresLoadSchematizationType.Quadratic, LoadSchematizationType.Quadratic)]
+ public void ConvertTo_ForAllEnumValues_ReturnExpectedType(ConfigurationStabilityPointStructuresLoadSchematizationType value,
+ LoadSchematizationType expectedText)
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+
+ // Call
+ object result = converter.ConvertTo(null, CultureInfo.CurrentCulture, value, typeof(LoadSchematizationType));
+
+ // Assert
+ Assert.AreEqual(expectedText, result);
+ }
+
+ [Test]
+ public void CanConvertFrom_String_ReturnTrue()
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+
+ // Call
+ bool canConvertFromString = converter.CanConvertFrom(typeof(string));
+
+ // Assert
+ Assert.IsTrue(canConvertFromString);
+ }
+
+ [Test]
+ public void CanConvertFrom_LoadSchematizationType_ReturnTrue()
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+
+ // Call
+ bool canConvertFromString = converter.CanConvertFrom(typeof(LoadSchematizationType));
+
+ // Assert
+ Assert.IsTrue(canConvertFromString);
+ }
+
+ [Test]
+ public void CanConvertFrom_OtherThanStringOrLoadSchematizationType_ReturnFalse()
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+
+ // Call
+ bool canConvertFromString = converter.CanConvertFrom(typeof(object));
+
+ // Assert
+ Assert.IsFalse(canConvertFromString);
+ }
+
+ [Test]
+ [TestCase(StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationLinearStructure, ConfigurationStabilityPointStructuresLoadSchematizationType.Linear)]
+ [TestCase(StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationQuadraticStructure, ConfigurationStabilityPointStructuresLoadSchematizationType.Quadratic)]
+ public void ConvertFrom_Text_ReturnExpectedConfigurationStabilityPointStructuresLoadSchematizationType(string value,
+ ConfigurationStabilityPointStructuresLoadSchematizationType expectedResult)
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+
+ // Call
+ object result = converter.ConvertFrom(value);
+
+ // Assert
+ Assert.AreEqual(expectedResult, result);
+ }
+
+ [Test]
+ public void ConvertFrom_InvalidType_ThrowNotSupportedException()
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+
+ // Call
+ TestDelegate call = () => converter.ConvertFrom(new object());
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void ConvertFrom_InvalidText_ThrowNotSupportedException()
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+ const string invalidValue = "some text";
+
+ // Call
+ TestDelegate call = () => converter.ConvertFrom(invalidValue);
+
+ // Assert
+ string message = Assert.Throws(call).Message;
+ Assert.AreEqual($"Value '{invalidValue}' is not supported.", message);
+ }
+
+ [Test]
+ public void ConvertFrom_InvalidLoadSchematizationType_ThrowNotSupportedException()
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+ const LoadSchematizationType invalidValue = (LoadSchematizationType) 983;
+
+ // Call
+ TestDelegate call = () => converter.ConvertFrom(invalidValue);
+
+ // Assert
+ string message = Assert.Throws(call).Message;
+ Assert.AreEqual($"Value '{invalidValue}' is not supported.", message);
+ }
+
+ [Test]
+ [TestCase(LoadSchematizationType.Linear, ConfigurationStabilityPointStructuresLoadSchematizationType.Linear)]
+ [TestCase(LoadSchematizationType.Quadratic, ConfigurationStabilityPointStructuresLoadSchematizationType.Quadratic)]
+ public void ConvertFrom_StabilityPointStructureInflowModelType_ReturnExpectedConfigurationInflowModelType(
+ LoadSchematizationType value,
+ ConfigurationStabilityPointStructuresLoadSchematizationType expectedResult)
+ {
+ // Setup
+ var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter();
+
+ // Call
+ object result = converter.ConvertFrom(value);
+
+ // Assert
+ Assert.AreEqual(expectedResult, result);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/Ringtoets.StabilityPointStructures.IO.Test.csproj
===================================================================
diff -u -r306d53c7436437d23464f9d0bf104fe699eb7e3f -r3a0181621fb32832a78d734a6ece4cc4a3a3e683
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/Ringtoets.StabilityPointStructures.IO.Test.csproj (.../Ringtoets.StabilityPointStructures.IO.Test.csproj) (revision 306d53c7436437d23464f9d0bf104fe699eb7e3f)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/Ringtoets.StabilityPointStructures.IO.Test.csproj (.../Ringtoets.StabilityPointStructures.IO.Test.csproj) (revision 3a0181621fb32832a78d734a6ece4cc4a3a3e683)
@@ -48,6 +48,7 @@
Properties\GlobalAssembly.cs
+
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/StabilityPointStructuresCalculationConfigurationTest.cs
===================================================================
diff -u -r306d53c7436437d23464f9d0bf104fe699eb7e3f -r3a0181621fb32832a78d734a6ece4cc4a3a3e683
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/StabilityPointStructuresCalculationConfigurationTest.cs (.../StabilityPointStructuresCalculationConfigurationTest.cs) (revision 306d53c7436437d23464f9d0bf104fe699eb7e3f)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/StabilityPointStructuresCalculationConfigurationTest.cs (.../StabilityPointStructuresCalculationConfigurationTest.cs) (revision 3a0181621fb32832a78d734a6ece4cc4a3a3e683)
@@ -67,6 +67,7 @@
Assert.IsNull(configuration.InsideWaterLevelFailureConstruction);
Assert.IsNull(configuration.LevelCrestStructure);
Assert.IsNull(configuration.LevellingCount);
+ Assert.IsNull(configuration.LoadSchematizationType);
Assert.IsNull(configuration.ProbabilityCollisionSecondaryStructure);
Assert.IsNull(configuration.ShipMass);
Assert.IsNull(configuration.ShipVelocity);
@@ -83,30 +84,35 @@
// Setup
var configuration = new StabilityPointStructuresCalculationConfiguration("some name");
var random = new Random(5432);
+
var areaFlowApertures = new MeanStandardDeviationStochastConfiguration();
var bankWidth = new MeanStandardDeviationStochastConfiguration();
- var constructiveStrengthLinearLoadModel = new MeanVariationCoefficientStochastConfiguration();
- var constructiveStrengthQuadraticLoadModel = new MeanVariationCoefficientStochastConfiguration();
var drainCoefficient = new MeanStandardDeviationStochastConfiguration();
- double evaluationLevel = random.NextDouble();
- double factorStormDurationOpenStructure = random.NextDouble();
- var failureCollisionEnergy = new MeanVariationCoefficientStochastConfiguration();
- double failureProbabilityRepairClosure = random.NextDouble();
- var flowVelocityStructureClosable = new MeanVariationCoefficientStochastConfiguration();
- var inflowModelType = random.NextEnumValue();
var insideWaterLevel = new MeanStandardDeviationStochastConfiguration();
var insideWaterLevelFailureConstruction = new MeanStandardDeviationStochastConfiguration();
var levelCrestStructure = new MeanStandardDeviationStochastConfiguration();
- int levellingCount = random.Next();
- double probabilityCollisionSecondaryStructure = random.NextDouble();
+ var thresholdHeightOpenWeir = new MeanStandardDeviationStochastConfiguration();
+
+ var constructiveStrengthLinearLoadModel = new MeanVariationCoefficientStochastConfiguration();
+ var constructiveStrengthQuadraticLoadModel = new MeanVariationCoefficientStochastConfiguration();
+ var failureCollisionEnergy = new MeanVariationCoefficientStochastConfiguration();
+ var flowVelocityStructureClosable = new MeanVariationCoefficientStochastConfiguration();
var shipMass = new MeanVariationCoefficientStochastConfiguration();
var shipVelocity = new MeanVariationCoefficientStochastConfiguration();
var stabilityLinearLoadModel = new MeanVariationCoefficientStochastConfiguration();
var stabilityQuadraticLoadModel = new MeanVariationCoefficientStochastConfiguration();
- var thresholdHeightOpenWeir = new MeanStandardDeviationStochastConfiguration();
+
+ int levellingCount = random.Next();
+ double evaluationLevel = random.NextDouble();
+ double factorStormDurationOpenStructure = random.NextDouble();
+ double failureProbabilityRepairClosure = random.NextDouble();
+ double probabilityCollisionSecondaryStructure = random.NextDouble();
double verticalDistance = random.NextDouble();
double volumicWeightWater = random.NextDouble();
+ var inflowModelType = random.NextEnumValue();
+ var loadSchematizationType = random.NextEnumValue();
+
// Call
configuration.AreaFlowApertures = areaFlowApertures;
configuration.BankWidth = bankWidth;
@@ -123,6 +129,7 @@
configuration.InsideWaterLevelFailureConstruction = insideWaterLevelFailureConstruction;
configuration.LevelCrestStructure = levelCrestStructure;
configuration.LevellingCount = levellingCount;
+ configuration.LoadSchematizationType = loadSchematizationType;
configuration.ProbabilityCollisionSecondaryStructure = probabilityCollisionSecondaryStructure;
configuration.ShipMass = shipMass;
configuration.ShipVelocity = shipVelocity;
@@ -148,6 +155,7 @@
Assert.AreEqual(insideWaterLevelFailureConstruction, configuration.InsideWaterLevelFailureConstruction);
Assert.AreEqual(levelCrestStructure, configuration.LevelCrestStructure);
Assert.AreEqual(levellingCount, configuration.LevellingCount);
+ Assert.AreEqual(loadSchematizationType, configuration.LoadSchematizationType);
Assert.AreEqual(probabilityCollisionSecondaryStructure, configuration.ProbabilityCollisionSecondaryStructure);
Assert.AreSame(shipMass, configuration.ShipMass);
Assert.AreSame(shipVelocity, configuration.ShipVelocity);
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/StabilityPointStructuresConfigurationSchemaIdentifiersTest.cs
===================================================================
diff -u -re37e45f2e21aa0bf7cb46da85878c18cc2586efe -r3a0181621fb32832a78d734a6ece4cc4a3a3e683
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/StabilityPointStructuresConfigurationSchemaIdentifiersTest.cs (.../StabilityPointStructuresConfigurationSchemaIdentifiersTest.cs) (revision e37e45f2e21aa0bf7cb46da85878c18cc2586efe)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/StabilityPointStructuresConfigurationSchemaIdentifiersTest.cs (.../StabilityPointStructuresConfigurationSchemaIdentifiersTest.cs) (revision 3a0181621fb32832a78d734a6ece4cc4a3a3e683)
@@ -47,6 +47,9 @@
Assert.AreEqual("binnenwaterstandbijfalen", StabilityPointStructuresConfigurationSchemaIdentifiers.InsideWaterLevelFailureConstructionStochastName);
Assert.AreEqual("kerendehoogte", StabilityPointStructuresConfigurationSchemaIdentifiers.LevelCrestStructureStochastName);
Assert.AreEqual("nrnivelleringen", StabilityPointStructuresConfigurationSchemaIdentifiers.LevellingCountElement);
+ Assert.AreEqual("belastingschematisering", StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationTypeElement);
+ Assert.AreEqual("lineair", StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationLinearStructure);
+ Assert.AreEqual("kwadratisch", StabilityPointStructuresConfigurationSchemaIdentifiers.LoadSchematizationQuadraticStructure);
Assert.AreEqual("kansaanvaringtweedekeermiddel", StabilityPointStructuresConfigurationSchemaIdentifiers.ProbabilityCollisionSecondaryStructureElement);
Assert.AreEqual("massaschip", StabilityPointStructuresConfigurationSchemaIdentifiers.ShipMassStochastName);
Assert.AreEqual("aanvaarsnelheid", StabilityPointStructuresConfigurationSchemaIdentifiers.ShipVelocityStochastName);