Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Configurations/ConfigurationTangentLineDeterminationType.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Configurations/ConfigurationTangentLineDeterminationType.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Configurations/ConfigurationTangentLineDeterminationType.cs (revision b1704785efb083ed440cff2afe2199db168fab07)
@@ -0,0 +1,33 @@
+// Copyright (C) Stichting Deltares 2017. 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.
+
+namespace Ringtoets.MacroStabilityInwards.IO.Configurations
+{
+ ///
+ /// Defines the various tangent line determination types in a read calculation configuration.
+ ///
+ public enum ConfigurationTangentLineDeterminationType
+ {
+ Specified = 1,
+
+ LayerSeparated = 2
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Configurations/Helpers/ConfigurationTangentLineDeterminationTypeConverter.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Configurations/Helpers/ConfigurationTangentLineDeterminationTypeConverter.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Configurations/Helpers/ConfigurationTangentLineDeterminationTypeConverter.cs (revision b1704785efb083ed440cff2afe2199db168fab07)
@@ -0,0 +1,71 @@
+// Copyright (C) Stichting Deltares 2017. 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.MacroStabilityInwards.Data;
+
+namespace Ringtoets.MacroStabilityInwards.IO.Configurations.Helpers
+{
+ ///
+ /// Converts to and back.
+ ///
+ public class ConfigurationTangentLineDeterminationTypeConverter : TypeConverter
+ {
+ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
+ {
+ return destinationType == typeof(MacroStabilityInwardsTangentLineDeterminationType)
+ || base.CanConvertTo(context, destinationType);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if (destinationType == typeof(string))
+ {
+ var type = (ConfigurationTangentLineDeterminationType) value;
+ switch (type)
+ {
+ case ConfigurationTangentLineDeterminationType.Specified:
+ return MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.TangentLineDeterminationTypeSpecified;
+ case ConfigurationTangentLineDeterminationType.LayerSeparated:
+ return MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.TangentLineDeterminationTypeLayerSeparated;
+ default:
+ throw new NotSupportedException();
+ }
+ }
+ if (destinationType == typeof(MacroStabilityInwardsTangentLineDeterminationType))
+ {
+ var type = (ConfigurationTangentLineDeterminationType) value;
+ switch (type)
+ {
+ case ConfigurationTangentLineDeterminationType.Specified:
+ return MacroStabilityInwardsTangentLineDeterminationType.Specified;
+ case ConfigurationTangentLineDeterminationType.LayerSeparated:
+ return MacroStabilityInwardsTangentLineDeterminationType.LayerSeparated;
+ default:
+ throw new NotSupportedException();
+ }
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Configurations/MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.cs
===================================================================
diff -u -r12ccd3dc7621c2cfc790f71e2b49f7acfdce04e1 -rb1704785efb083ed440cff2afe2199db168fab07
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Configurations/MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.cs (.../MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.cs) (revision 12ccd3dc7621c2cfc790f71e2b49f7acfdce04e1)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Configurations/MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.cs (.../MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.cs) (revision b1704785efb083ed440cff2afe2199db168fab07)
@@ -19,6 +19,8 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using Ringtoets.MacroStabilityInwards.Data;
+
namespace Ringtoets.MacroStabilityInwards.IO.Configurations
{
///
@@ -45,5 +47,22 @@
/// The identifier for stochastic soil profile elements.
///
public const string StochasticSoilProfileElement = "ondergrondschematisatie";
+
+ ///
+ /// The identifier for the tangent line determination type elements.
+ ///
+ public const string TangentLineDeterminationTypeElement = "bepalingtangentlijnen";
+
+ ///
+ /// The possible content of the
+ /// element indicating layer separated.
+ ///
+ public const string TangentLineDeterminationTypeLayerSeparated = "laagscheiding";
+
+ ///
+ /// The possible content of the
+ /// element indicating specified.
+ ///
+ public const string TangentLineDeterminationTypeSpecified = "gespecificeerd";
}
}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Ringtoets.MacroStabilityInwards.IO.csproj
===================================================================
diff -u -r39df1b649c1da3040e3786ab46db646a7fb2e089 -rb1704785efb083ed440cff2afe2199db168fab07
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Ringtoets.MacroStabilityInwards.IO.csproj (.../Ringtoets.MacroStabilityInwards.IO.csproj) (revision 39df1b649c1da3040e3786ab46db646a7fb2e089)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Ringtoets.MacroStabilityInwards.IO.csproj (.../Ringtoets.MacroStabilityInwards.IO.csproj) (revision b1704785efb083ed440cff2afe2199db168fab07)
@@ -35,6 +35,8 @@
Properties\GlobalAssembly.cs
+
+
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Configurations/Helpers/ConfigurationTangentLineDeterminationTypeConverterTest.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Configurations/Helpers/ConfigurationTangentLineDeterminationTypeConverterTest.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Configurations/Helpers/ConfigurationTangentLineDeterminationTypeConverterTest.cs (revision b1704785efb083ed440cff2afe2199db168fab07)
@@ -0,0 +1,155 @@
+// Copyright (C) Stichting Deltares 2017. 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.Collections.Generic;
+using System.ComponentModel;
+using NUnit.Framework;
+using Ringtoets.MacroStabilityInwards.Data;
+using Ringtoets.MacroStabilityInwards.IO.Configurations;
+using Ringtoets.MacroStabilityInwards.IO.Configurations.Helpers;
+
+namespace Ringtoets.MacroStabilityInwards.IO.Test.Configurations.Helpers
+{
+ [TestFixture]
+ public class ConfigurationTangentLineDeterminationTypeConverterTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var converter = new ConfigurationTangentLineDeterminationTypeConverter();
+
+ // Assert
+ Assert.IsInstanceOf(converter);
+ }
+
+ [Test]
+ [TestCaseSource(nameof(GetConvertToSupportedTypes))]
+ public void CanConvertTo_String_ReturnTrue(Type supportedType)
+ {
+ // Setup
+ var converter = new ConfigurationTangentLineDeterminationTypeConverter();
+
+ // Call
+ bool convertTo = converter.CanConvertTo(supportedType);
+
+ // Assert
+ Assert.IsTrue(convertTo);
+ }
+
+ [Test]
+ public void CanConvertTo_OtherType_ReturnFalse()
+ {
+ // Setup
+ var converter = new ConfigurationTangentLineDeterminationTypeConverter();
+
+ // Call
+ bool convertTo = converter.CanConvertTo(typeof(object));
+
+ // Assert
+ Assert.IsFalse(convertTo);
+ }
+
+ [Test]
+ [TestCaseSource(nameof(SupporterConvertions), new object[]
+ {
+ "ConvertTo_{2}_Returns{1}"
+ })]
+ public void ConvertTo_VariousCases_ReturnExpectedResult(ConfigurationTangentLineDeterminationType value,
+ Type convertToType,
+ object expectedResult)
+ {
+ // Setup
+ var converter = new ConfigurationTangentLineDeterminationTypeConverter();
+
+ // Call
+ object result = converter.ConvertTo(value, convertToType);
+
+ // Assert
+ Assert.AreEqual(expectedResult, result);
+ }
+
+ [Test]
+ [TestCaseSource(nameof(InvalidConvertions), new object[]
+ {
+ "ConvertTo_Convert{2}to{1}_ThrowsNotSupportedException"
+ })]
+ public void ConvertTo_Invalid_ThrowsNotSupportedException(ConfigurationTangentLineDeterminationType invalidValue,
+ Type convertToType)
+ {
+ // Setup
+ var converter = new ConfigurationTangentLineDeterminationTypeConverter();
+ ;
+
+ // Call
+ TestDelegate call = () => converter.ConvertTo(invalidValue, convertToType);
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ private static IEnumerable GetConvertToSupportedTypes()
+ {
+ const string testName = "CanConvertTo_{0}_ReturnTrue";
+
+ yield return new TestCaseData(typeof(string))
+ .SetName(testName);
+ yield return new TestCaseData(typeof(MacroStabilityInwardsTangentLineDeterminationType))
+ .SetName(testName);
+ }
+
+ private static IEnumerable SupporterConvertions(string testName)
+ {
+ Type stringType = typeof(string);
+ Type tangentLineDeterminationType = typeof(MacroStabilityInwardsTangentLineDeterminationType);
+
+ yield return new TestCaseData(ConfigurationTangentLineDeterminationType.LayerSeparated,
+ stringType,
+ MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.TangentLineDeterminationTypeLayerSeparated)
+ .SetName(testName);
+ yield return new TestCaseData(ConfigurationTangentLineDeterminationType.Specified,
+ stringType,
+ MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.TangentLineDeterminationTypeSpecified)
+ .SetName(testName);
+
+ yield return new TestCaseData(ConfigurationTangentLineDeterminationType.LayerSeparated,
+ tangentLineDeterminationType,
+ MacroStabilityInwardsTangentLineDeterminationType.LayerSeparated)
+ .SetName(testName);
+ yield return new TestCaseData(ConfigurationTangentLineDeterminationType.Specified,
+ tangentLineDeterminationType,
+ MacroStabilityInwardsTangentLineDeterminationType.Specified)
+ .SetName(testName);
+ }
+
+ private static IEnumerable InvalidConvertions(string testName)
+ {
+ yield return new TestCaseData((ConfigurationTangentLineDeterminationType) 99999,
+ typeof(string))
+ .SetName(testName);
+
+ yield return new TestCaseData((ConfigurationTangentLineDeterminationType) 99999,
+ typeof(MacroStabilityInwardsTangentLineDeterminationType))
+ .SetName(testName);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Configurations/MacroStabilityInwardsCalculationConfigurationSchemaIdentifiersTest.cs
===================================================================
diff -u -rf03b47d0d73983de35188874a094ae07f1ea13fa -rb1704785efb083ed440cff2afe2199db168fab07
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Configurations/MacroStabilityInwardsCalculationConfigurationSchemaIdentifiersTest.cs (.../MacroStabilityInwardsCalculationConfigurationSchemaIdentifiersTest.cs) (revision f03b47d0d73983de35188874a094ae07f1ea13fa)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Configurations/MacroStabilityInwardsCalculationConfigurationSchemaIdentifiersTest.cs (.../MacroStabilityInwardsCalculationConfigurationSchemaIdentifiersTest.cs) (revision b1704785efb083ed440cff2afe2199db168fab07)
@@ -34,6 +34,9 @@
Assert.AreEqual("profielschematisatie", MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.SurfaceLineElement);
Assert.AreEqual("ondergrondmodel", MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.StochasticSoilModelElement);
Assert.AreEqual("ondergrondschematisatie", MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.StochasticSoilProfileElement);
+ Assert.AreEqual("bepalingtangentlijnen", MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.TangentLineDeterminationTypeElement);
+ Assert.AreEqual("laagscheiding", MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.TangentLineDeterminationTypeLayerSeparated);
+ Assert.AreEqual("gespecificeerd", MacroStabilityInwardsCalculationConfigurationSchemaIdentifiers.TangentLineDeterminationTypeSpecified);
}
}
}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj
===================================================================
diff -u -r94fbe0ddb5936201eaffc5bab789a39ee7a245ef -rb1704785efb083ed440cff2afe2199db168fab07
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.Test.csproj) (revision 94fbe0ddb5936201eaffc5bab789a39ee7a245ef)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.Test.csproj) (revision b1704785efb083ed440cff2afe2199db168fab07)
@@ -58,6 +58,7 @@
Properties\GlobalAssembly.cs
+