Index: Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs
===================================================================
diff -u -r17a2476bd707ad3da72ba4d6382915b9cc3fed07 -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 17a2476bd707ad3da72ba4d6382915b9cc3fed07)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -1729,6 +1729,27 @@
}
///
+ /// Looks up a localized string similar to Het faalmechanisme '{0}' wordt niet ondersteund..
+ ///
+ public static string StochasticSoilModelReader_ReadFailureMechanismType_Failure_mechanism_0_not_supported {
+ get {
+ return ResourceManager.GetString("StochasticSoilModelReader_ReadFailureMechanismType_Failure_mechanism_0_not_suppor" +
+ "ted", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to {0}
+ ///Deze ondergrondschematisatie wordt overgeslagen..
+ ///
+ public static string StochasticSoilModelReader_ReadSoilProfiles_ParseErrorMessage_0_SoilProfile_skipped {
+ get {
+ return ResourceManager.GetString("StochasticSoilModelReader_ReadSoilProfiles_ParseErrorMessage_0_SoilProfile_skippe" +
+ "d", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Er zijn geen ondergrondschematisaties gevonden in het stochastische ondergrondmodel '{0}'.
///
public static string StochasticSoilModelReader_ReadStochasticSoilProfiles_No_profiles_found_in_stochastic_soil_model_Name_0_ {
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx
===================================================================
diff -u -r17a2476bd707ad3da72ba4d6382915b9cc3fed07 -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx (.../Resources.resx) (revision 17a2476bd707ad3da72ba4d6382915b9cc3fed07)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx (.../Resources.resx) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -851,4 +851,11 @@
Het stochastische ondergrondmodel '{0}' moet een geometrie bevatten.
+
+ {0}
+Deze ondergrondschematisatie wordt overgeslagen.
+
+
+ Het faalmechanisme '{0}' wordt niet ondersteund.
+
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj
===================================================================
diff -u -r83eac2f8b272c0306bec2f92a028c23737505624 -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 83eac2f8b272c0306bec2f92a028c23737505624)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -120,6 +120,7 @@
+
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/FailureMechanismType.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/FailureMechanismType.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/FailureMechanismType.cs (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -0,0 +1,43 @@
+// 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.Common.IO.SoilProfile.Schema
+{
+ ///
+ /// Defines the various failure mechanism types in the DSoil-Model database.
+ ///
+ public enum FailureMechanismType : long
+ {
+ None = 0,
+ Stability = 1,
+ Settlement = 2,
+ PipingUpliftGradient = 3,
+ Piping = 4,
+ FlowSlide = 6,
+ Overtopping = 7,
+ AnchorLoading = 9,
+ DAM = 10,
+ Structures = 11,
+ BlockRevetment = 12,
+ Dunes = 14,
+ AsphaltRevetment = 15
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/MechanismTableDefinitions.cs
===================================================================
diff -u -r6379e5b1f8fd510f54137ceed602bd2900cdf235 -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/MechanismTableDefinitions.cs (.../MechanismTableDefinitions.cs) (revision 6379e5b1f8fd510f54137ceed602bd2900cdf235)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/MechanismTableDefinitions.cs (.../MechanismTableDefinitions.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -40,17 +40,5 @@
/// Gets the name of the failure mechanism name column.
///
public const string MechanismName = "ME_Name";
-
- ///
- /// Gets the name of the piping failure mechanism value in the
- /// column.
- ///
- public const string MechanismNamePiping = "Piping";
-
- ///
- /// Gets the name of the macro stability inwards failure mechanism value in the
- /// column.
- ///
- public const string MechanismNameMacroStabilityInwards = "Stability";
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/SegmentPointsTableDefinitions.cs
===================================================================
diff -u -r6379e5b1f8fd510f54137ceed602bd2900cdf235 -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/SegmentPointsTableDefinitions.cs (.../SegmentPointsTableDefinitions.cs) (revision 6379e5b1f8fd510f54137ceed602bd2900cdf235)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/SegmentPointsTableDefinitions.cs (.../SegmentPointsTableDefinitions.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -32,11 +32,6 @@
public const string TableName = "SegmentPoints";
///
- /// Gets the name of the segment id column.
- ///
- public const string SegmentId = "SE_ID";
-
- ///
/// Gets the name of the world x coordinate column.
///
public const string CoordinateX = "XWorld";
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/SegmentTableDefinitions.cs
===================================================================
diff -u -r1d91b8411e6db990c17fade0ad12aa8ac0e54865 -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/SegmentTableDefinitions.cs (.../SegmentTableDefinitions.cs) (revision 1d91b8411e6db990c17fade0ad12aa8ac0e54865)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/SegmentTableDefinitions.cs (.../SegmentTableDefinitions.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -35,10 +35,5 @@
/// Gets the name of the segment id column.
///
public const string SegmentId = "SE_ID";
-
- ///
- /// Gets the name of the segment name column.
- ///
- public const string SegmentName = "SE_Name";
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/StochasticSoilProfileTableDefinitions.cs
===================================================================
diff -u -rda8e78c538a77ceea5a0709122e9e28ef573507b -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/StochasticSoilProfileTableDefinitions.cs (.../StochasticSoilProfileTableDefinitions.cs) (revision da8e78c538a77ceea5a0709122e9e28ef573507b)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/Schema/StochasticSoilProfileTableDefinitions.cs (.../StochasticSoilProfileTableDefinitions.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -32,11 +32,6 @@
public const string TableName = "StochasticSoilProfile";
///
- /// Gets the name of the stochastic soil model id column.
- ///
- public const string StochasticSoilModelId = "SSM_ID";
-
- ///
/// Gets the name of the stochastic soil profile 1D id column.
///
public const string SoilProfile1DId = "SP1D_ID";
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilDatabaseQueryBuilder.cs
===================================================================
diff -u -r17a2476bd707ad3da72ba4d6382915b9cc3fed07 -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilDatabaseQueryBuilder.cs (.../SoilDatabaseQueryBuilder.cs) (revision 17a2476bd707ad3da72ba4d6382915b9cc3fed07)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilDatabaseQueryBuilder.cs (.../SoilDatabaseQueryBuilder.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -106,7 +106,7 @@
public static string GetStochasticSoilModelPerMechanismQuery()
{
return $"SELECT SSM.{StochasticSoilModelTableDefinitions.StochasticSoilModelId}, " +
- $"M.{MechanismTableDefinitions.MechanismName}, " +
+ $"M.{MechanismTableDefinitions.MechanismId}, M.{MechanismTableDefinitions.MechanismName}, " +
$"SSM.{StochasticSoilModelTableDefinitions.StochasticSoilModelName}, " +
$"SSP.{StochasticSoilProfileTableDefinitions.Probability}, " +
$"SSP.{StochasticSoilProfileTableDefinitions.SoilProfile1DId}, " +
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile1D.cs
===================================================================
diff -u -recd4d4b6e6b86aea559e4dee86f46850ee1477bf -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile1D.cs (.../SoilProfile1D.cs) (revision ecd4d4b6e6b86aea559e4dee86f46850ee1477bf)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile1D.cs (.../SoilProfile1D.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -44,8 +44,8 @@
/// Thrown when:
///
/// - contains no layers
- /// - contains a layer with the less than
- ///
+ /// - contains a layer with the
+ /// less than
///
///
public SoilProfile1D(long id, string name, double bottom, IEnumerable layers)
@@ -71,7 +71,13 @@
/// for the .
///
/// Thrown when the value is null.
- /// Thrown when the value contains no layers.
+ /// Thrown when:
+ ///
+ /// - contains no layers
+ /// - contains a layer with the
+ /// less than
+ ///
+ ///
public IEnumerable Layers
{
get
@@ -93,12 +99,13 @@
///
/// The collection of to validate.
/// Thrown when is null.
- /// Thrown when
+ /// Thrown when:
///
/// - contains no layers
- /// - contains a layer with the less than
- ///
- ///
+ /// - contains a layer with the
+ /// less than
+ ///
+ ///
private void ValidateLayersCollection(IEnumerable layers)
{
if (layers == null)
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile2D.cs
===================================================================
diff -u -recd4d4b6e6b86aea559e4dee86f46850ee1477bf -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile2D.cs (.../SoilProfile2D.cs) (revision ecd4d4b6e6b86aea559e4dee86f46850ee1477bf)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile2D.cs (.../SoilProfile2D.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -46,6 +46,9 @@
///
public long Id { get; }
+ ///
+ /// Gets the collection of layers that are part of the profile.
+ ///
public IEnumerable Layers { get; }
public string Name { get; }
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilModel.cs
===================================================================
diff -u -rae772a69de783815504f095c4d1b7ea83a6716c2 -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilModel.cs (.../StochasticSoilModel.cs) (revision ae772a69de783815504f095c4d1b7ea83a6716c2)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilModel.cs (.../StochasticSoilModel.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -19,8 +19,10 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using System.Collections.Generic;
using Core.Common.Base.Geometry;
+using Ringtoets.Common.IO.SoilProfile.Schema;
namespace Ringtoets.Common.IO.SoilProfile
{
@@ -33,19 +35,33 @@
///
/// Creates a new instance of .
///
- public StochasticSoilModel()
+ /// The name of the stochastic soil model.
+ /// The failure mechanism this stochastic soil model belongs to.
+ /// Thrown when is null.
+ public StochasticSoilModel(string name, FailureMechanismType failureMechanismType)
{
- Name = string.Empty;
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ Name = name;
+ FailureMechanismType = failureMechanismType;
Geometry = new List();
StochasticSoilProfiles = new List();
}
///
/// Gets the name of the segment soil model.
///
- public string Name { get; set; }
+ public string Name { get; }
///
+ /// Gets the failure mechanism the soil model applies to.
+ ///
+ public FailureMechanismType FailureMechanismType { get; }
+
+ ///
/// Gets the list of geometry points.
///
public List Geometry { get; }
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilModelReader.cs
===================================================================
diff -u -r83eac2f8b272c0306bec2f92a028c23737505624 -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilModelReader.cs (.../StochasticSoilModelReader.cs) (revision 83eac2f8b272c0306bec2f92a028c23737505624)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilModelReader.cs (.../StochasticSoilModelReader.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -88,8 +88,12 @@
/// if no more soil models can be read.
/// Thrown when the database returned incorrect
/// values for required properties.
- /// Thrown when no stochastic soil profiles
- /// could be read for this stochastic soil model.
+ /// Thrown when:
+ ///
+ /// - no stochastic soil profiles could be read;
+ /// - the read failure mechanism type is not supported.
+ ///
+ ///
public StochasticSoilModel ReadStochasticSoilModel()
{
try
@@ -177,6 +181,17 @@
}
}
+ ///
+ /// Creates a new from the data reader.
+ ///
+ /// The next from the database, or null
+ /// if no more soil models can be read.
+ /// Thrown when:
+ ///
+ /// - no stochastic soil profiles could be read;
+ /// - the read failure mechanism type is not supported.
+ ///
+ ///
private StochasticSoilModel TryReadStochasticSoilModel()
{
if (!HasNext)
@@ -199,7 +214,12 @@
///
/// The database identifier of the soil model.
/// The read stochastic soil profiles.
- /// Thrown when no stochastic soil profiles could be read.
+ /// Thrown when:
+ ///
+ /// - no stochastic soil profiles could be read;
+ /// - the read failure mechanism type is not supported.
+ ///
+ ///
private IEnumerable ReadStochasticSoilProfiles(long stochasticSoilModelId)
{
while (HasNext && ReadStochasticSoilModelId() == stochasticSoilModelId)
@@ -229,46 +249,15 @@
}
}
- private double? ReadStochasticSoilProfileProbability()
- {
- object probability = dataReader[StochasticSoilProfileTableDefinitions.Probability];
- return probability == Convert.DBNull
- ? (double?) null
- : Convert.ToDouble(probability);
- }
-
- private long? ReadSoilProfile1DId()
- {
- object soilProfileId = dataReader[StochasticSoilProfileTableDefinitions.SoilProfile1DId];
- return soilProfileId == Convert.DBNull
- ? (long?) null
- : Convert.ToInt64(soilProfileId);
- }
-
- private long? ReadSoilProfile2DId()
- {
- object soilProfileId = dataReader[StochasticSoilProfileTableDefinitions.SoilProfile2DId];
- return soilProfileId == Convert.DBNull
- ? (long?) null
- : Convert.ToInt64(soilProfileId);
- }
-
- private long ReadStochasticSoilModelId()
- {
- return Convert.ToInt64(dataReader[StochasticSoilModelTableDefinitions.StochasticSoilModelId]);
- }
-
- private string ReadStochasticSoilModelName()
- {
- return Convert.ToString(dataReader[StochasticSoilModelTableDefinitions.StochasticSoilModelName]);
- }
-
+ ///
+ /// Creates a new basic , based on the data read from the data reader.
+ ///
+ /// The newly created .
+ /// Thrown when the read failure mechanism
+ /// type is not supported.
private StochasticSoilModel CreateStochasticSoilModel()
{
- return new StochasticSoilModel
- {
- Name = ReadStochasticSoilModelName()
- };
+ return new StochasticSoilModel(ReadStochasticSoilModelName(), ReadFailureMechanismType());
}
///
@@ -338,5 +327,93 @@
reader.VerifyConstraints();
}
}
+
+ #region Read columns
+
+ ///
+ /// Reads the stochastic soil profile probability from the data reader.
+ ///
+ /// The 1D soil profile id.
+ /// The read value is not in an appropriate format.
+ /// The read value represents a number that is less
+ /// than or greater than .
+ private double? ReadStochasticSoilProfileProbability()
+ {
+ object probability = dataReader[StochasticSoilProfileTableDefinitions.Probability];
+ return probability == Convert.DBNull
+ ? (double?) null
+ : Convert.ToDouble(probability);
+ }
+
+ ///
+ /// Reads the 1D soil profile id from the data reader.
+ ///
+ /// The 1D soil profile id.
+ /// The read value is not in an appropriate format.
+ /// The read value represents a number that is less
+ /// than or greater than .
+ private long? ReadSoilProfile1DId()
+ {
+ object soilProfileId = dataReader[StochasticSoilProfileTableDefinitions.SoilProfile1DId];
+ return soilProfileId == Convert.DBNull
+ ? (long?) null
+ : Convert.ToInt64(soilProfileId);
+ }
+
+ ///
+ /// Reads the 2D soil profile id from the data reader.
+ ///
+ /// The 2D soil profile id.
+ /// The read value is not in an appropriate format.
+ /// The read value represents a number that is less
+ /// than or greater than .
+ private long? ReadSoilProfile2DId()
+ {
+ object soilProfileId = dataReader[StochasticSoilProfileTableDefinitions.SoilProfile2DId];
+ return soilProfileId == Convert.DBNull
+ ? (long?) null
+ : Convert.ToInt64(soilProfileId);
+ }
+
+ ///
+ /// Reads the stochastic soil model id from the data reader.
+ ///
+ /// The stochastic soil model id.
+ /// The read value is not in an appropriate format.
+ /// The read value represents a number that is less
+ /// than or greater than .
+ private long ReadStochasticSoilModelId()
+ {
+ return Convert.ToInt64(dataReader[StochasticSoilModelTableDefinitions.StochasticSoilModelId]);
+ }
+
+ private string ReadStochasticSoilModelName()
+ {
+ return Convert.ToString(dataReader[StochasticSoilModelTableDefinitions.StochasticSoilModelName]);
+ }
+
+ private string ReadMechanismName()
+ {
+ return Convert.ToString(dataReader[MechanismTableDefinitions.MechanismName]);
+ }
+
+ ///
+ /// Reads the failure mechanism type from the data reader.
+ ///
+ /// The failure mechanism type.
+ /// Thrown when the read failure mechanism type is not supported.
+ private FailureMechanismType ReadFailureMechanismType()
+ {
+ long mechanismId = Convert.ToInt64(dataReader[MechanismTableDefinitions.MechanismId]);
+ if (Enum.IsDefined(typeof(FailureMechanismType), mechanismId))
+ {
+ return (FailureMechanismType) mechanismId;
+ }
+
+ string message = string.Format(Resources.StochasticSoilModelReader_ReadFailureMechanismType_Failure_mechanism_0_not_supported, ReadMechanismName());
+ throw new StochasticSoilModelException(message);
+ }
+
+ #endregion
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilProfile.cs
===================================================================
diff -u -r6f3f1fabca21935a2198e59ee423f833b75a3d36 -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilProfile.cs (.../StochasticSoilProfile.cs) (revision 6f3f1fabca21935a2198e59ee423f833b75a3d36)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilProfile.cs (.../StochasticSoilProfile.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -40,10 +40,15 @@
///
/// Probability of the stochastic soil profile.
/// The soil profile.
+ /// Thrown when is null.
/// Thrown when the
/// is outside the range [0, 1].
public StochasticSoilProfile(double probability, ISoilProfile soilProfile)
{
+ if (soilProfile == null)
+ {
+ throw new ArgumentNullException(nameof(soilProfile));
+ }
Probability = probability;
SoilProfile = soilProfile;
}
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilDatabaseQueryBuilderTest.cs
===================================================================
diff -u -r17a2476bd707ad3da72ba4d6382915b9cc3fed07 -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilDatabaseQueryBuilderTest.cs (.../SoilDatabaseQueryBuilderTest.cs) (revision 17a2476bd707ad3da72ba4d6382915b9cc3fed07)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilDatabaseQueryBuilderTest.cs (.../SoilDatabaseQueryBuilderTest.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -78,7 +78,7 @@
// Assert
const string expectedQuery =
- "SELECT SSM.SSM_ID, M.ME_Name, SSM.SSM_Name, SSP.Probability, SSP.SP1D_ID, SSP.SP2D_ID " +
+ "SELECT SSM.SSM_ID, M.ME_ID, M.ME_Name, SSM.SSM_Name, SSP.Probability, SSP.SP1D_ID, SSP.SP2D_ID " +
"FROM Mechanism M " +
"INNER JOIN Segment S USING(ME_ID) " +
"INNER JOIN StochasticSoilModel SSM USING(SSM_ID) " +
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/StochasticSoilModelReaderTest.cs
===================================================================
diff -u -r17a2476bd707ad3da72ba4d6382915b9cc3fed07 -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/StochasticSoilModelReaderTest.cs (.../StochasticSoilModelReaderTest.cs) (revision 17a2476bd707ad3da72ba4d6382915b9cc3fed07)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/StochasticSoilModelReaderTest.cs (.../StochasticSoilModelReaderTest.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -262,6 +262,29 @@
}
[Test]
+ public void ReadStochasticSoilModel_OtherFailureMechanism_ThrowsStochasticSoilModelException()
+ {
+ // Setup
+ string dbFile = Path.Combine(testDataPath, "otherFailureMechanism.soil");
+
+ using (var reader = new StochasticSoilModelReader(dbFile))
+ {
+ reader.Validate();
+
+ // Call
+ TestDelegate test = () => reader.ReadStochasticSoilModel();
+
+ // Assert
+ var exception = Assert.Throws(test);
+
+ const string expectedMessage = "Het faalmechanisme 'AssessmentLevel' wordt niet ondersteund.";
+ Assert.AreEqual(expectedMessage, exception.Message);
+ }
+
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile));
+ }
+
+ [Test]
public void ReadStochasticSoilModel_SoilModelWithoutStochasticSoilProfile_ThrowsStochasticSoilModelExceptionAndHasNext()
{
// Setup
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/StochasticSoilModelTest.cs
===================================================================
diff -u -rae772a69de783815504f095c4d1b7ea83a6716c2 -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/StochasticSoilModelTest.cs (.../StochasticSoilModelTest.cs) (revision ae772a69de783815504f095c4d1b7ea83a6716c2)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/StochasticSoilModelTest.cs (.../StochasticSoilModelTest.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -19,22 +19,44 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
+using Core.Common.TestUtil;
using NUnit.Framework;
using Ringtoets.Common.IO.SoilProfile;
+using Ringtoets.Common.IO.SoilProfile.Schema;
namespace Ringtoets.Common.IO.Test.SoilProfile
{
[TestFixture]
public class StochasticSoilModelTest
{
[Test]
+ public void Constructor_NameNull_ExpectedValues()
+ {
+ // Setup
+ var failureMechanismType = new Random(145).NextEnumValue();
+
+ // Call
+ TestDelegate test = () => new StochasticSoilModel(null, failureMechanismType);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("name", paramName);
+ }
+
+ [Test]
public void Constructor_Always_ExpectedValues()
{
+ // Setup
+ const string name = "some name";
+ var failureMechanismType = new Random(145).NextEnumValue();
+
// Call
- var stochasticSoilModel = new StochasticSoilModel();
+ var stochasticSoilModel = new StochasticSoilModel(name, failureMechanismType);
// Assert
- Assert.AreEqual(string.Empty, stochasticSoilModel.Name);
+ Assert.AreEqual(name, stochasticSoilModel.Name);
+ Assert.AreEqual(failureMechanismType, stochasticSoilModel.FailureMechanismType);
CollectionAssert.IsEmpty(stochasticSoilModel.Geometry);
CollectionAssert.IsEmpty(stochasticSoilModel.StochasticSoilProfiles);
}
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/StochasticSoilProfileTest.cs
===================================================================
diff -u -r6f3f1fabca21935a2198e59ee423f833b75a3d36 -rbe4427a66ef77dfa213048b0a823824ea679bce3
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 6f3f1fabca21935a2198e59ee423f833b75a3d36)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision be4427a66ef77dfa213048b0a823824ea679bce3)
@@ -55,6 +55,17 @@
}
[TestCase]
+ public void Constructor_SoilProfileNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new StochasticSoilProfile(0.5, null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("soilProfile", paramName);
+ }
+
+ [TestCase]
public void Constructor_WithValidArguments_ExpectedValues()
{
// Setup
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/StochasticSoilModelReader/otherFailureMechanism.soil
===================================================================
diff -u
Binary files differ