Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj
===================================================================
diff -u -r25dd6ff5b74aec73e47df4488c05439a143711e1 -r3bf7e84ac84de7dd0be38be7e9f2372878e733f6
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -82,8 +82,8 @@
-
-
+
+
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilModel.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilModel.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilModel.cs (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -0,0 +1,73 @@
+// 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.Collections.Generic;
+using Core.Common.Base.Geometry;
+
+namespace Ringtoets.Piping.Data
+{
+ ///
+ /// This class represents a stochastic soil model which consists out of a collection of .
+ /// A stochastic soil model contains a segment for which the model applies.
+ ///
+ public class StochasticSoilModel
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// Database identifier of the stochastic soil model.
+ /// Name of the segment soil model.
+ /// Name of the segment soil model segment.
+ public StochasticSoilModel(long segmentSoilModelId, string segmentSoilModelName, string segmentName)
+ {
+ SegmentSoilModelId = segmentSoilModelId;
+ SegmentSoilModelName = segmentSoilModelName;
+ SegmentName = segmentName;
+ Geometry = new List();
+ StochasticSoilProfileProbabilities = new List();
+ }
+
+ ///
+ /// Gets the database identifier of the stochastic soil model.
+ ///
+ public long SegmentSoilModelId { get; private set; }
+
+ ///
+ /// Gets the name of the segment soil model.
+ ///
+ public string SegmentSoilModelName { get; private set; }
+
+ ///
+ /// /// Gets the name of the segment soil model segment.
+ ///
+ public string SegmentName { get; private set; }
+
+ ///
+ /// Gets or sets the list of geometry points.
+ ///
+ public List Geometry { get; private set; }
+
+ ///
+ /// Gets or sets the list of .
+ ///
+ public List StochasticSoilProfileProbabilities { get; private set; }
+ }
+}
\ No newline at end of file
Fisheye: Tag 3bf7e84ac84de7dd0be38be7e9f2372878e733f6 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilModelSegment.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfile.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfile.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfile.cs (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -0,0 +1,57 @@
+// 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.
+
+namespace Ringtoets.Piping.Data
+{
+ ///
+ /// This class couples a SoilProfile to a probability of occurrence.
+ ///
+ public class StochasticSoilProfile
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// Probability of the stochastic soil profile.
+ /// Type of the stochastic soil profile.
+ /// Database identifier of the stochastic soil profile.
+ public StochasticSoilProfile(double probability, SoilProfileType soilProfileType, long soilProfileId)
+ {
+ Probability = probability;
+ SoilProfileType = soilProfileType;
+ SoilProfileId = soilProfileId;
+ }
+
+ ///
+ /// Gets the type of the stochastic soil profile.
+ ///
+ public SoilProfileType SoilProfileType { get; private set; }
+
+ ///
+ /// Gets the database identifier of the stochastic soil profile.
+ ///
+ public long SoilProfileId { get; private set; }
+
+ ///
+ /// Gets the probability of the stochastic soil profile.
+ ///
+ public double Probability { get; private set; }
+ }
+}
\ No newline at end of file
Fisheye: Tag 3bf7e84ac84de7dd0be38be7e9f2372878e733f6 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfileProbability.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilDatabaseQueryBuilder.cs
===================================================================
diff -u -r25dd6ff5b74aec73e47df4488c05439a143711e1 -r3bf7e84ac84de7dd0be38be7e9f2372878e733f6
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilDatabaseQueryBuilder.cs (.../SoilDatabaseQueryBuilder.cs) (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilDatabaseQueryBuilder.cs (.../SoilDatabaseQueryBuilder.cs) (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -25,13 +25,13 @@
namespace Ringtoets.Piping.IO.Builders
{
///
- /// Defines queries to execute on the Soil-Model database.
+ /// Defines queries to execute on the DSoil-Model database.
///
public static class SoilDatabaseQueryBuilder
{
///
/// Returns the SQL query to execute to fetch Stochastic Soil Models
- /// of the Piping Mechanism from the Soil-Model database.
+ /// of the Piping Mechanism from the DSoil-Model database.
///
/// The SQL query to execute.
/// @ME_Name needs to be
@@ -62,7 +62,7 @@
///
/// Returns the SQL query to execute to fetch all Stochastic Soil Profiles
- /// from the Soil-Model database.
+ /// from the DSoil-Model database.
///
/// The SQL query to execute.
public static string GetAllStochasticSoilProfileQuery()
@@ -77,7 +77,7 @@
}
///
- /// Returns the SQL query to execute to check if version of the Soil-Model database is as expected.
+ /// Returns the SQL query to execute to check if version of the DSoil-Model database is as expected.
///
/// The SQL query to execute.
/// @Value needs to be
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilProfileBuilder2D.cs
===================================================================
diff -u -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb -r3bf7e84ac84de7dd0be38be7e9f2372878e733f6
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilProfileBuilder2D.cs (.../SoilProfileBuilder2D.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilProfileBuilder2D.cs (.../SoilProfileBuilder2D.cs) (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -87,7 +87,7 @@
/// The .
/// Thrown when the 's geometry
/// contains vertical segments the X-coordinate given for the construction of the
- /// .
+ /// .
internal SoilProfileBuilder2D Add(SoilLayer2D soilLayer)
{
double newBottom;
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs
===================================================================
diff -u -r14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7 -r3bf7e84ac84de7dd0be38be7e9f2372878e733f6
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -319,18 +319,18 @@
///
/// Looks up a localized string similar to Kon geen ondergrond modellen verkrijgen van de database..
///
- public static string StochasticSoilModelDatabaseReader_failed_to_read_database {
+ public static string StochasticSoilModelDatabaseReader_Failed_to_read_database {
get {
- return ResourceManager.GetString("StochasticSoilModelDatabaseReader_failed_to_read_database", resourceCulture);
+ return ResourceManager.GetString("StochasticSoilModelDatabaseReader_Failed_to_read_database", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Het uitlezen van een stochastisch ondergrondsmodel misgelukt, deze zal worden overgeslagen..
+ /// Looks up a localized string similar to Het uitlezen van een stochastisch ondergrondsmodel is mislukt, deze zal worden overgeslagen..
///
- public static string StochasticSoilModelDatabaseReader_failed_to_read_soil_model {
+ public static string StochasticSoilModelDatabaseReader_Failed_to_read_soil_model {
get {
- return ResourceManager.GetString("StochasticSoilModelDatabaseReader_failed_to_read_soil_model", resourceCulture);
+ return ResourceManager.GetString("StochasticSoilModelDatabaseReader_Failed_to_read_soil_model", resourceCulture);
}
}
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx
===================================================================
diff -u -r14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7 -r3bf7e84ac84de7dd0be38be7e9f2372878e733f6
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx (.../Resources.resx) (revision 14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx (.../Resources.resx) (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -204,10 +204,10 @@
Profielmeting heeft een geometrie die een lijn met lengte 0 beschrijft.
-
- Het uitlezen van een stochastisch ondergrondsmodel misgelukt, deze zal worden overgeslagen.
+
+ Het uitlezen van een stochastisch ondergrondsmodel is mislukt, deze zal worden overgeslagen.
-
+
Kon geen ondergrond modellen verkrijgen van de database.
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/PipingSoilProfileReader.cs
===================================================================
diff -u -r950036d17f885045ddc733fb05b1bb8719ca94d8 -r3bf7e84ac84de7dd0be38be7e9f2372878e733f6
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/PipingSoilProfileReader.cs (.../PipingSoilProfileReader.cs) (revision 950036d17f885045ddc733fb05b1bb8719ca94d8)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/PipingSoilProfileReader.cs (.../PipingSoilProfileReader.cs) (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -57,18 +57,7 @@
///
public PipingSoilProfileReader(string databaseFilePath) : base(databaseFilePath)
{
- using (var versionReader = new SoilDatabaseVersionReader(databaseFilePath))
- {
- try
- {
- versionReader.VerifyVersion();
- }
- catch (CriticalFileReadException)
- {
- CloseConnection();
- throw;
- }
- }
+ VerifyVersion(databaseFilePath);
InitializeReader();
}
@@ -155,6 +144,22 @@
return (T) dataReader[columnName];
}
+ private void VerifyVersion(string databaseFilePath)
+ {
+ using (var versionReader = new SoilDatabaseVersionReader(databaseFilePath))
+ {
+ try
+ {
+ versionReader.VerifyVersion();
+ }
+ catch (CriticalFileReadException)
+ {
+ CloseConnection();
+ throw;
+ }
+ }
+ }
+
///
/// Reads a from the database.
///
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilDatabaseVersionReader.cs
===================================================================
diff -u -r950036d17f885045ddc733fb05b1bb8719ca94d8 -r3bf7e84ac84de7dd0be38be7e9f2372878e733f6
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilDatabaseVersionReader.cs (.../SoilDatabaseVersionReader.cs) (revision 950036d17f885045ddc733fb05b1bb8719ca94d8)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilDatabaseVersionReader.cs (.../SoilDatabaseVersionReader.cs) (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -69,21 +69,26 @@
try
{
- using (SQLiteDataReader dataReader = CreateDataReader(checkVersionQuery, sqliteParameter))
- {
- if (!dataReader.HasRows)
- {
- throw new CriticalFileReadException(String.Format(
- Resources.PipingSoilProfileReader_Database_incorrect_version_requires_Version_0_,
- databaseRequiredVersion));
- }
- }
+ ReadVersion(checkVersionQuery, sqliteParameter);
}
catch (SQLiteException exception)
{
var message = new FileReaderErrorMessageBuilder(Path).Build(Resources.PipingSoilProfileReader_Critical_Unexpected_value_on_column);
throw new CriticalFileReadException(message, exception);
}
}
+
+ private void ReadVersion(string checkVersionQuery, SQLiteParameter sqliteParameter)
+ {
+ using (SQLiteDataReader dataReader = CreateDataReader(checkVersionQuery, sqliteParameter))
+ {
+ if (!dataReader.HasRows)
+ {
+ throw new CriticalFileReadException(String.Format(
+ Resources.PipingSoilProfileReader_Database_incorrect_version_requires_Version_0_,
+ databaseRequiredVersion));
+ }
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilModelDatabaseReader.cs
===================================================================
diff -u -r0415d97c8733babb1a31bc11de23ee4b0c5038b6 -r3bf7e84ac84de7dd0be38be7e9f2372878e733f6
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilModelDatabaseReader.cs (.../StochasticSoilModelDatabaseReader.cs) (revision 0415d97c8733babb1a31bc11de23ee4b0c5038b6)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilModelDatabaseReader.cs (.../StochasticSoilModelDatabaseReader.cs) (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -35,7 +35,7 @@
namespace Ringtoets.Piping.IO.SoilProfile
{
///
- /// This class reads a soil database file and reads from this database.
+ /// This class reads a soil database file and reads from this database.
///
public class StochasticSoilModelDatabaseReader : SqLiteDatabaseReaderBase
{
@@ -58,6 +58,11 @@
///
public StochasticSoilModelDatabaseReader(string databaseFilePath) : base(databaseFilePath)
{
+ VerifyVersion(databaseFilePath);
+ }
+
+ private void VerifyVersion(string databaseFilePath)
+ {
using (var versionReader = new SoilDatabaseVersionReader(databaseFilePath))
{
try
@@ -73,11 +78,11 @@
}
///
- /// Reads the of failure mechanism "Piping" from the databae.
+ /// Reads the of failure mechanism "Piping" from the databae.
///
- /// List of , read from the database.
+ /// List of , read from the database.
/// Thrown when failed to read the database.
- public IEnumerable GetStochasticSoilModelSegmentOfPiping()
+ public IEnumerable GetStochasticSoilModelSegmentOfPiping()
{
var stochasticSoilModelSegmentsQuery = SoilDatabaseQueryBuilder.GetStochasticSoilModelOfMechanismQuery();
var sqliteParameter = new SQLiteParameter
@@ -100,7 +105,7 @@
}
catch (SQLiteException exception)
{
- var message = new FileReaderErrorMessageBuilder(Path).Build(Resources.StochasticSoilModelDatabaseReader_failed_to_read_database);
+ var message = new FileReaderErrorMessageBuilder(Path).Build(Resources.StochasticSoilModelDatabaseReader_Failed_to_read_database);
throw new CriticalFileReadException(message, exception);
}
}
@@ -114,10 +119,10 @@
base.Dispose();
}
- private IEnumerable ReadStochasticSoilModels(SQLiteDataReader dataReader)
+ private IEnumerable ReadStochasticSoilModels(SQLiteDataReader dataReader)
{
- var segmentSoilModels = new List();
- StochasticSoilModelSegment currentStochasticSoilModelSegment = null;
+ var segmentSoilModels = new List();
+ StochasticSoilModel currentStochasticSoilModelSegment = null;
while (MoveNext(dataReader))
{
// Read Points
@@ -148,7 +153,7 @@
// Add
segmentSoilModels.Add(segmentSoilModel);
}
- currentStochasticSoilModelSegment.SegmentPoints.Add(point2D);
+ currentStochasticSoilModelSegment.Geometry.Add(point2D);
}
return segmentSoilModels;
}
@@ -166,9 +171,9 @@
return true;
}
- private IEnumerable ReadStochasticSoilProfileProbability(long stochasticSoilModelId)
+ private IEnumerable ReadStochasticSoilProfileProbability(long stochasticSoilModelId)
{
- var probabilityList = new List();
+ var probabilityList = new List();
try
{
long currentStochasticSoilModelId;
@@ -194,7 +199,7 @@
{
if (exception is FormatException || exception is OverflowException || exception is InvalidCastException)
{
- log.Warn(Resources.StochasticSoilModelDatabaseReader_failed_to_read_soil_model);
+ log.Warn(Resources.StochasticSoilModelDatabaseReader_Failed_to_read_soil_model);
return null;
}
throw;
@@ -207,7 +212,7 @@
return Convert.ToInt64(dataReader[StochasticSoilProfileDatabaseColumns.StochasticSoilModelId]);
}
- private static StochasticSoilProfileProbability ReadStochasticSoilProfileProbability(SQLiteDataReader dataReader)
+ private static StochasticSoilProfile ReadStochasticSoilProfileProbability(SQLiteDataReader dataReader)
{
var valueSoilProfile1DId = dataReader[StochasticSoilProfileDatabaseColumns.SoilProfile1DId];
var valueSoilProfile2DId = dataReader[StochasticSoilProfileDatabaseColumns.SoilProfile2DId];
@@ -218,23 +223,23 @@
if (!valueSoilProfile1DId.Equals(DBNull.Value))
{
var soilProfileId = Convert.ToInt64(valueSoilProfile1DId);
- return new StochasticSoilProfileProbability(probability, SoilProfileType.SoilProfile1D, soilProfileId);
+ return new StochasticSoilProfile(probability, SoilProfileType.SoilProfile1D, soilProfileId);
}
if (!valueSoilProfile2DId.Equals(DBNull.Value))
{
var soilProfileId = Convert.ToInt64(valueSoilProfile2DId);
- return new StochasticSoilProfileProbability(probability, SoilProfileType.SoilProfile2D, soilProfileId);
+ return new StochasticSoilProfile(probability, SoilProfileType.SoilProfile2D, soilProfileId);
}
- log.Warn(Resources.StochasticSoilModelDatabaseReader_failed_to_read_soil_model);
+ log.Warn(Resources.StochasticSoilModelDatabaseReader_Failed_to_read_soil_model);
return null;
}
- private static StochasticSoilModelSegment ReadStochasticSoilModelSegment(SQLiteDataReader dataReader)
+ private static StochasticSoilModel ReadStochasticSoilModelSegment(SQLiteDataReader dataReader)
{
var stochasticSoilModelId = Convert.ToInt64(dataReader[StochasticSoilModelDatabaseColumns.StochasticSoilModelId]);
var stochasticSoilModelName = Convert.ToString(dataReader[StochasticSoilModelDatabaseColumns.StochasticSoilModelName]);
var segmentName = Convert.ToString(dataReader[SegmentDatabaseColumns.SegmentName]);
- return new StochasticSoilModelSegment(stochasticSoilModelId, stochasticSoilModelName, segmentName);
+ return new StochasticSoilModel(stochasticSoilModelId, stochasticSoilModelName, segmentName);
}
private static Point2D ReadSegmentPoint(SQLiteDataReader dataReader)
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj
===================================================================
diff -u -r25dd6ff5b74aec73e47df4488c05439a143711e1 -r3bf7e84ac84de7dd0be38be7e9f2372878e733f6
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -79,8 +79,8 @@
-
-
+
+
Fisheye: Tag 3bf7e84ac84de7dd0be38be7e9f2372878e733f6 refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilModelSegmentTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilModelTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilModelTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilModelTest.cs (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -0,0 +1,94 @@
+// 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 Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace Ringtoets.Piping.Data.Test
+{
+ [TestFixture]
+ public class StochasticSoilModelTest
+ {
+ [Test]
+ [TestCase(1234L, "", "")]
+ [TestCase(5678L, "segmentSoilModelName", "segmentName")]
+ public void Constructor_Always_ExpectedValues(long segmentSoilModelId, string segmentSoilModelName, string segmentName)
+ {
+ // Call
+ StochasticSoilModel stochasticSoilModelSegment = new StochasticSoilModel(segmentSoilModelId, segmentSoilModelName, segmentName);
+
+ // Assert
+ Assert.IsInstanceOf(stochasticSoilModelSegment);
+ Assert.AreEqual(segmentSoilModelId, stochasticSoilModelSegment.SegmentSoilModelId);
+ Assert.AreEqual(segmentSoilModelName, stochasticSoilModelSegment.SegmentSoilModelName);
+ Assert.AreEqual(segmentName, stochasticSoilModelSegment.SegmentName);
+ CollectionAssert.IsEmpty(stochasticSoilModelSegment.Geometry);
+ CollectionAssert.IsEmpty(stochasticSoilModelSegment.StochasticSoilProfileProbabilities);
+ }
+
+ [Test]
+ public void PropertySegmentPoints_Always_ReturnsExpectedValues()
+ {
+ // Setup
+ const long expectedSegmentSoilModelId = 1234L;
+ const string expectedSegmentSoilModelName = "someSegmentSoilModelName";
+ const string expectedSegmentName = "someSegmentName";
+ StochasticSoilModel stochasticSoilModelSegment = new StochasticSoilModel(expectedSegmentSoilModelId, expectedSegmentSoilModelName, expectedSegmentName);
+ var point2D = new Point2D(1.0, 2.0);
+
+ // Call
+ stochasticSoilModelSegment.Geometry.Add(point2D);
+
+ // Assert
+ Assert.AreEqual(expectedSegmentSoilModelId, stochasticSoilModelSegment.SegmentSoilModelId);
+ Assert.AreEqual(expectedSegmentSoilModelName, stochasticSoilModelSegment.SegmentSoilModelName);
+ Assert.AreEqual(expectedSegmentName, stochasticSoilModelSegment.SegmentName);
+ Assert.AreEqual(1, stochasticSoilModelSegment.Geometry.Count);
+ Assert.AreEqual(point2D, stochasticSoilModelSegment.Geometry[0]);
+ }
+
+ [Test]
+ public void PropertyStochasticSoilProfileProbabilities_Always_ReturnsExpectedValues()
+ {
+ // Setup
+ const long expectedSegmentSoilModelId = 1234L;
+ const string expectedSegmentSoilModelName = "someSegmentSoilModelName";
+ const string expectedSegmentName = "someSegmentName";
+ StochasticSoilModel stochasticSoilModelSegment = new StochasticSoilModel(expectedSegmentSoilModelId, expectedSegmentSoilModelName, expectedSegmentName);
+
+ MockRepository mockRepository = new MockRepository();
+ var stochasticSoilProfileProbabilityMock = mockRepository.StrictMock(1.0, null, null);
+ mockRepository.ReplayAll();
+
+ // Call
+ stochasticSoilModelSegment.StochasticSoilProfileProbabilities.Add(stochasticSoilProfileProbabilityMock);
+
+ // Assert
+ Assert.AreEqual(expectedSegmentSoilModelId, stochasticSoilModelSegment.SegmentSoilModelId);
+ Assert.AreEqual(expectedSegmentSoilModelName, stochasticSoilModelSegment.SegmentSoilModelName);
+ Assert.AreEqual(expectedSegmentName, stochasticSoilModelSegment.SegmentName);
+ Assert.AreEqual(1, stochasticSoilModelSegment.StochasticSoilProfileProbabilities.Count);
+ Assert.AreEqual(stochasticSoilProfileProbabilityMock, stochasticSoilModelSegment.StochasticSoilProfileProbabilities[0]);
+ mockRepository.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 3bf7e84ac84de7dd0be38be7e9f2372878e733f6 refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileProbabilityTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -0,0 +1,44 @@
+// 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 NUnit.Framework;
+
+namespace Ringtoets.Piping.Data.Test
+{
+ [TestFixture]
+ public class StochasticSoilProfileTest
+ {
+ [Test]
+ [TestCase(1.0, SoilProfileType.SoilProfile1D, 123L)]
+ [TestCase(2.0, SoilProfileType.SoilProfile2D, 123L)]
+ public void Constructor_Always_ExpectedValues(double probability, SoilProfileType soilProfileType, long soilProfileId)
+ {
+ // Call
+ StochasticSoilProfile stochasticSoilProfileProbability = new StochasticSoilProfile(probability, soilProfileType, soilProfileId);
+
+ // Assert
+ Assert.IsInstanceOf(stochasticSoilProfileProbability);
+ Assert.AreEqual(probability, stochasticSoilProfileProbability.Probability);
+ Assert.AreEqual(soilProfileType, stochasticSoilProfileProbability.SoilProfileType);
+ Assert.AreEqual(soilProfileId, stochasticSoilProfileProbability.SoilProfileId);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilModelDatabaseReaderTest.cs
===================================================================
diff -u -r950036d17f885045ddc733fb05b1bb8719ca94d8 -r3bf7e84ac84de7dd0be38be7e9f2372878e733f6
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilModelDatabaseReaderTest.cs (.../StochasticSoilModelDatabaseReaderTest.cs) (revision 950036d17f885045ddc733fb05b1bb8719ca94d8)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilModelDatabaseReaderTest.cs (.../StochasticSoilModelDatabaseReaderTest.cs) (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -139,7 +139,7 @@
// Setup
var dbName = "emptyschema.soil";
string dbFile = Path.Combine(testDataPath, dbName);
- IEnumerable stochasticSoilModelSegment;
+ IEnumerable stochasticSoilModelSegment;
// Precondition
Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile), "Precondition: file can be opened for edits.");
@@ -159,7 +159,7 @@
public void GetStochasticSoilModelSegmentOfPiping_CompleteScenario_ReturnsExpectedValues()
{
// Setup
- List segmentSoilModels;
+ List segmentSoilModels;
const string dbName = "complete.soil";
var dbFile = Path.Combine(testDataPath, dbName);
const int expectedSegmentSoilModels = 3;
@@ -192,36 +192,36 @@
}
// Assert
- Assert.IsInstanceOf>(segmentSoilModels);
- CollectionAssert.AllItemsAreInstancesOfType(segmentSoilModels, typeof(StochasticSoilModelSegment));
+ Assert.IsInstanceOf>(segmentSoilModels);
+ CollectionAssert.AllItemsAreInstancesOfType(segmentSoilModels, typeof(StochasticSoilModel));
Assert.AreEqual(expectedSegmentSoilModels, segmentSoilModels.Count);
- StochasticSoilModelSegment stochasticSoilModelSegmentSoilModel1 = segmentSoilModels[0];
+ StochasticSoilModel stochasticSoilModelSegmentSoilModel1 = segmentSoilModels[0];
Assert.AreEqual(expectedSegmentName1, stochasticSoilModelSegmentSoilModel1.SegmentName);
Assert.AreEqual(expectedSegmentSoilModelName1, stochasticSoilModelSegmentSoilModel1.SegmentSoilModelName);
Assert.AreEqual(expectedSegmentSoilModelId1, stochasticSoilModelSegmentSoilModel1.SegmentSoilModelId);
- Assert.AreEqual(expectedSegmentSoilModelPoints1, stochasticSoilModelSegmentSoilModel1.SegmentPoints.Count);
- CollectionAssert.AllItemsAreInstancesOfType(stochasticSoilModelSegmentSoilModel1.SegmentPoints, typeof(Point2D));
+ Assert.AreEqual(expectedSegmentSoilModelPoints1, stochasticSoilModelSegmentSoilModel1.Geometry.Count);
+ CollectionAssert.AllItemsAreInstancesOfType(stochasticSoilModelSegmentSoilModel1.Geometry, typeof(Point2D));
Assert.AreEqual(expectedSegmentSoilModelProbabilities1, stochasticSoilModelSegmentSoilModel1.StochasticSoilProfileProbabilities.Count);
- CollectionAssert.AllItemsAreInstancesOfType(stochasticSoilModelSegmentSoilModel1.StochasticSoilProfileProbabilities, typeof(StochasticSoilProfileProbability));
+ CollectionAssert.AllItemsAreInstancesOfType(stochasticSoilModelSegmentSoilModel1.StochasticSoilProfileProbabilities, typeof(StochasticSoilProfile));
- StochasticSoilModelSegment stochasticSoilModelSegmentSoilModel2 = segmentSoilModels[1];
+ StochasticSoilModel stochasticSoilModelSegmentSoilModel2 = segmentSoilModels[1];
Assert.AreEqual(expectedSegmentName2, stochasticSoilModelSegmentSoilModel2.SegmentName);
Assert.AreEqual(expectedSegmentSoilModelName2, stochasticSoilModelSegmentSoilModel2.SegmentSoilModelName);
Assert.AreEqual(expectedSegmentSoilModelId2, stochasticSoilModelSegmentSoilModel2.SegmentSoilModelId);
- Assert.AreEqual(expectedSegmentSoilModelPoints2, stochasticSoilModelSegmentSoilModel2.SegmentPoints.Count);
- CollectionAssert.AllItemsAreInstancesOfType(stochasticSoilModelSegmentSoilModel2.SegmentPoints, typeof(Point2D));
+ Assert.AreEqual(expectedSegmentSoilModelPoints2, stochasticSoilModelSegmentSoilModel2.Geometry.Count);
+ CollectionAssert.AllItemsAreInstancesOfType(stochasticSoilModelSegmentSoilModel2.Geometry, typeof(Point2D));
Assert.AreEqual(expectedSegmentSoilModelProbabilities2, stochasticSoilModelSegmentSoilModel2.StochasticSoilProfileProbabilities.Count);
- CollectionAssert.AllItemsAreInstancesOfType(stochasticSoilModelSegmentSoilModel2.StochasticSoilProfileProbabilities, typeof(StochasticSoilProfileProbability));
+ CollectionAssert.AllItemsAreInstancesOfType(stochasticSoilModelSegmentSoilModel2.StochasticSoilProfileProbabilities, typeof(StochasticSoilProfile));
- StochasticSoilModelSegment stochasticSoilModelSegmentSoilModel3 = segmentSoilModels[2];
+ StochasticSoilModel stochasticSoilModelSegmentSoilModel3 = segmentSoilModels[2];
Assert.AreEqual(expectedSegmentName3, stochasticSoilModelSegmentSoilModel3.SegmentName);
Assert.AreEqual(expectedSegmentSoilModelName3, stochasticSoilModelSegmentSoilModel3.SegmentSoilModelName);
Assert.AreEqual(expectedSegmentSoilModelId3, stochasticSoilModelSegmentSoilModel3.SegmentSoilModelId);
- Assert.AreEqual(expectedSegmentSoilModelPoints3, stochasticSoilModelSegmentSoilModel3.SegmentPoints.Count);
- CollectionAssert.AllItemsAreInstancesOfType(stochasticSoilModelSegmentSoilModel3.SegmentPoints, typeof(Point2D));
+ Assert.AreEqual(expectedSegmentSoilModelPoints3, stochasticSoilModelSegmentSoilModel3.Geometry.Count);
+ CollectionAssert.AllItemsAreInstancesOfType(stochasticSoilModelSegmentSoilModel3.Geometry, typeof(Point2D));
Assert.AreEqual(expectedSegmentSoilModelProbabilities3, stochasticSoilModelSegmentSoilModel3.StochasticSoilProfileProbabilities.Count);
- CollectionAssert.AllItemsAreInstancesOfType(stochasticSoilModelSegmentSoilModel3.StochasticSoilProfileProbabilities, typeof(StochasticSoilProfileProbability));
+ CollectionAssert.AllItemsAreInstancesOfType(stochasticSoilModelSegmentSoilModel3.StochasticSoilProfileProbabilities, typeof(StochasticSoilProfile));
}
[Test]
@@ -230,7 +230,7 @@
// Setup
var dbName = "withoutSoilModelTables.soil";
string dbFile = Path.Combine(testDataPath, dbName);
- string expectedMessage = new FileReaderErrorMessageBuilder(dbFile).Build(Resources.StochasticSoilModelDatabaseReader_failed_to_read_database);
+ string expectedMessage = new FileReaderErrorMessageBuilder(dbFile).Build(Resources.StochasticSoilModelDatabaseReader_Failed_to_read_database);
// Precondition
Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile), "Precondition: file can be opened for edits.");
@@ -255,7 +255,7 @@
// Setup
var dbName = "invalidSegmentPoint.soil";
string dbFile = Path.Combine(testDataPath, dbName);
- List stochasticSoilModelSegmentList = null;
+ List stochasticSoilModelSegmentList = null;
const string expectedLogMessage = "De coördinaten van het stochastisch ondergrondsmodel bevatten geen geldige waarde.";
// Precondition
@@ -270,13 +270,13 @@
}
// Assert
- Assert.IsInstanceOf>(stochasticSoilModelSegmentList);
+ Assert.IsInstanceOf>(stochasticSoilModelSegmentList);
Assert.AreEqual(2, stochasticSoilModelSegmentList.Count);
- StochasticSoilModelSegment stochasticSoilModelSegment1 = stochasticSoilModelSegmentList[0];
+ StochasticSoilModel stochasticSoilModelSegment1 = stochasticSoilModelSegmentList[0];
Assert.AreEqual(1, stochasticSoilModelSegment1.StochasticSoilProfileProbabilities.Count);
- StochasticSoilModelSegment stochasticSoilModelSegment2 = stochasticSoilModelSegmentList[1];
+ StochasticSoilModel stochasticSoilModelSegment2 = stochasticSoilModelSegmentList[1];
Assert.AreEqual(1, stochasticSoilModelSegment2.StochasticSoilProfileProbabilities.Count);
Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile));
}
@@ -287,7 +287,7 @@
// Setup
var dbName = "invalidStochasticSoilProfile.soil";
string dbFile = Path.Combine(testDataPath, dbName);
- List stochasticSoilModelSegmentList = null;
+ List stochasticSoilModelSegmentList = null;
const string expectedLogMessage = "Het uitlezen van een stochastisch ondergrondsmodel misgelukt, deze zal worden overgeslagen.";
// Precondition
@@ -302,7 +302,7 @@
}
// Assert
- Assert.IsInstanceOf>(stochasticSoilModelSegmentList);
+ Assert.IsInstanceOf>(stochasticSoilModelSegmentList);
Assert.AreEqual(0, stochasticSoilModelSegmentList.Count);
Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile));
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilModelSegmentTest.cs
===================================================================
diff -u -r25dd6ff5b74aec73e47df4488c05439a143711e1 -r3bf7e84ac84de7dd0be38be7e9f2372878e733f6
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilModelSegmentTest.cs (.../StochasticSoilModelSegmentTest.cs) (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilModelSegmentTest.cs (.../StochasticSoilModelSegmentTest.cs) (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -35,14 +35,14 @@
public void Constructor_Always_ExpectedValues(long segmentSoilModelId, string segmentSoilModelName, string segmentName)
{
// Call
- StochasticSoilModelSegment stochasticSoilModelSegment = new StochasticSoilModelSegment(segmentSoilModelId, segmentSoilModelName, segmentName);
+ StochasticSoilModel stochasticSoilModelSegment = new StochasticSoilModel(segmentSoilModelId, segmentSoilModelName, segmentName);
// Assert
- Assert.IsInstanceOf(stochasticSoilModelSegment);
+ Assert.IsInstanceOf(stochasticSoilModelSegment);
Assert.AreEqual(segmentSoilModelId, stochasticSoilModelSegment.SegmentSoilModelId);
Assert.AreEqual(segmentSoilModelName, stochasticSoilModelSegment.SegmentSoilModelName);
Assert.AreEqual(segmentName, stochasticSoilModelSegment.SegmentName);
- CollectionAssert.IsEmpty(stochasticSoilModelSegment.SegmentPoints);
+ CollectionAssert.IsEmpty(stochasticSoilModelSegment.Geometry);
CollectionAssert.IsEmpty(stochasticSoilModelSegment.StochasticSoilProfileProbabilities);
}
@@ -53,18 +53,18 @@
const long expectedSegmentSoilModelId = 1234L;
const string expectedSegmentSoilModelName = "someSegmentSoilModelName";
const string expectedSegmentName = "someSegmentName";
- StochasticSoilModelSegment stochasticSoilModelSegment = new StochasticSoilModelSegment(expectedSegmentSoilModelId, expectedSegmentSoilModelName, expectedSegmentName);
+ StochasticSoilModel stochasticSoilModelSegment = new StochasticSoilModel(expectedSegmentSoilModelId, expectedSegmentSoilModelName, expectedSegmentName);
var point2D = new Point2D(1.0, 2.0);
// Call
- stochasticSoilModelSegment.SegmentPoints.Add(point2D);
+ stochasticSoilModelSegment.Geometry.Add(point2D);
// Assert
Assert.AreEqual(expectedSegmentSoilModelId, stochasticSoilModelSegment.SegmentSoilModelId);
Assert.AreEqual(expectedSegmentSoilModelName, stochasticSoilModelSegment.SegmentSoilModelName);
Assert.AreEqual(expectedSegmentName, stochasticSoilModelSegment.SegmentName);
- Assert.AreEqual(1, stochasticSoilModelSegment.SegmentPoints.Count);
- Assert.AreEqual(point2D, stochasticSoilModelSegment.SegmentPoints[0]);
+ Assert.AreEqual(1, stochasticSoilModelSegment.Geometry.Count);
+ Assert.AreEqual(point2D, stochasticSoilModelSegment.Geometry[0]);
}
[Test]
@@ -74,10 +74,10 @@
const long expectedSegmentSoilModelId = 1234L;
const string expectedSegmentSoilModelName = "someSegmentSoilModelName";
const string expectedSegmentName = "someSegmentName";
- StochasticSoilModelSegment stochasticSoilModelSegment = new StochasticSoilModelSegment(expectedSegmentSoilModelId, expectedSegmentSoilModelName, expectedSegmentName);
+ StochasticSoilModel stochasticSoilModelSegment = new StochasticSoilModel(expectedSegmentSoilModelId, expectedSegmentSoilModelName, expectedSegmentName);
MockRepository mockRepository = new MockRepository();
- var stochasticSoilProfileProbabilityMock = mockRepository.StrictMock(1.0, null, null);
+ var stochasticSoilProfileProbabilityMock = mockRepository.StrictMock(1.0, null, null);
mockRepository.ReplayAll();
// Call
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilProfileProbabilityTest.cs
===================================================================
diff -u -r25dd6ff5b74aec73e47df4488c05439a143711e1 -r3bf7e84ac84de7dd0be38be7e9f2372878e733f6
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilProfileProbabilityTest.cs (.../StochasticSoilProfileProbabilityTest.cs) (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilProfileProbabilityTest.cs (.../StochasticSoilProfileProbabilityTest.cs) (revision 3bf7e84ac84de7dd0be38be7e9f2372878e733f6)
@@ -34,10 +34,10 @@
public void Constructor_Always_ExpectedValues(double probability, SoilProfileType soilProfileType, long soilProfileId)
{
// Call
- StochasticSoilProfileProbability stochasticSoilProfileProbability = new StochasticSoilProfileProbability(probability, soilProfileType, soilProfileId);
+ StochasticSoilProfile stochasticSoilProfileProbability = new StochasticSoilProfile(probability, soilProfileType, soilProfileId);
// Assert
- Assert.IsInstanceOf(stochasticSoilProfileProbability);
+ Assert.IsInstanceOf(stochasticSoilProfileProbability);
Assert.AreEqual(probability, stochasticSoilProfileProbability.Probability);
Assert.AreEqual(soilProfileType, stochasticSoilProfileProbability.SoilProfileType);
Assert.AreEqual(soilProfileId, stochasticSoilProfileProbability.SoilProfileId);