Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj
===================================================================
diff -u -rde18e9d8a0324e9345f412eb6c1ffeed4f86f2fb -r25dd6ff5b74aec73e47df4488c05439a143711e1
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision de18e9d8a0324e9345f412eb6c1ffeed4f86f2fb)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -81,6 +81,9 @@
Resources.resx
+
+
+
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/SoilProfileType.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/SoilProfileType.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/SoilProfileType.cs (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -0,0 +1,39 @@
+// 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
+{
+ ///
+ /// Defines the various types of soil profiles.
+ ///
+ public enum SoilProfileType
+ {
+ ///
+ /// One dimensional soil profile.
+ ///
+ SoilProfile1D,
+
+ ///
+ /// One dimensional soil profile.
+ ///
+ SoilProfile2D
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilModelSegment.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilModelSegment.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilModelSegment.cs (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -0,0 +1,72 @@
+// 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 the probability of stochastic soil profile.
+ ///
+ public class StochasticSoilModelSegment
+ {
+ ///
+ /// 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 StochasticSoilModelSegment(long segmentSoilModelId, string segmentSoilModelName, string segmentName)
+ {
+ SegmentSoilModelId = segmentSoilModelId;
+ SegmentSoilModelName = segmentSoilModelName;
+ SegmentName = segmentName;
+ SegmentPoints = 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 segment points.
+ ///
+ public List SegmentPoints { get; private set; }
+
+ ///
+ /// Gets or sets the list of .
+ ///
+ public List StochasticSoilProfileProbabilities { get; private set; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfileProbability.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfileProbability.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfileProbability.cs (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -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 represents the probability of stochastic soil profile.
+ ///
+ public class StochasticSoilProfileProbability
+ {
+ ///
+ /// 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 StochasticSoilProfileProbability(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
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilDatabaseQueryBuilder.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilDatabaseQueryBuilder.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilDatabaseQueryBuilder.cs (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -0,0 +1,95 @@
+// 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 Ringtoets.Piping.IO.SoilProfile;
+
+namespace Ringtoets.Piping.IO.Builders
+{
+ ///
+ /// Defines queries to execute on the Soil-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.
+ ///
+ /// The SQL query to execute.
+ /// @ME_Name needs to be
+ /// defined as .
+ public static string GetStochasticSoilModelOfMechanismQuery()
+ {
+ return String.Format(@"SELECT SP.{8}, SP.{9}, S.{10}, SSM.{11}, SSM.{12} " +
+ "FROM {0} M " +
+ "INNER JOIN {1} S USING({4}) " +
+ "INNER JOIN {2} SSM USING({5}) " +
+ "INNER JOIN {3} SP USING({6}) " +
+ "WHERE M.{7} = @{7} ORDER BY SSM.{12};",
+ MechanismDatabaseColumns.TableName,
+ SegmentDatabaseColumns.TableName,
+ StochasticSoilModelDatabaseColumns.TableName,
+ SegmentPointsDatabaseColumns.TableName,
+ MechanismDatabaseColumns.MechanismId,
+ StochasticSoilModelDatabaseColumns.StochasticSoilModelId,
+ SegmentPointsDatabaseColumns.SegmentId,
+ MechanismDatabaseColumns.MechanismName,
+ SegmentPointsDatabaseColumns.CoordinateX,
+ SegmentPointsDatabaseColumns.CoordinateY,
+ SegmentDatabaseColumns.SegmentName,
+ StochasticSoilModelDatabaseColumns.StochasticSoilModelName,
+ StochasticSoilModelDatabaseColumns.StochasticSoilModelId
+ );
+ }
+
+ ///
+ /// Returns the SQL query to execute to fetch all Stochastic Soil Profiles
+ /// from the Soil-Model database.
+ ///
+ /// The SQL query to execute.
+ public static string GetAllStochasticSoilProfileQuery()
+ {
+ return String.Format("SELECT {1}, {2}, {3}, {4} FROM {0} ORDER BY {1};",
+ StochasticSoilProfileDatabaseColumns.TableName,
+ StochasticSoilProfileDatabaseColumns.StochasticSoilModelId,
+ StochasticSoilProfileDatabaseColumns.Probability,
+ StochasticSoilProfileDatabaseColumns.SoilProfile1DId,
+ StochasticSoilProfileDatabaseColumns.SoilProfile2DId
+ );
+ }
+
+ ///
+ /// Returns the SQL query to execute to check if version of the Soil-Model database is as expected.
+ ///
+ /// The SQL query to execute.
+ /// @Value needs to be
+ /// defined as the required database version.
+ public static string GetCheckVersionQuery()
+ {
+ return String.Format(
+ "SELECT {2} FROM {0} WHERE {1} = 'VERSION' AND {2} = @{2};",
+ MetaDataDatabaseColumns.TableName,
+ MetaDataDatabaseColumns.Key,
+ MetaDataDatabaseColumns.Value
+ );
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj
===================================================================
diff -u -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb -r25dd6ff5b74aec73e47df4488c05439a143711e1
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -48,15 +48,13 @@
-
+
-
-
Fisheye: Tag 25dd6ff5b74aec73e47df4488c05439a143711e1 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/DSoilDatabaseQueryBuilder.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilModelDatabaseReader.cs
===================================================================
diff -u -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb -r25dd6ff5b74aec73e47df4488c05439a143711e1
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilModelDatabaseReader.cs (.../StochasticSoilModelDatabaseReader.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilModelDatabaseReader.cs (.../StochasticSoilModelDatabaseReader.cs) (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -28,10 +28,15 @@
using Core.Common.IO.Readers;
using Core.Common.Utils.Builders;
using log4net;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.IO.Builders;
using Ringtoets.Piping.IO.Properties;
namespace Ringtoets.Piping.IO.SoilProfile
{
+ ///
+ /// This class reads a soil database file and reads from this database.
+ ///
public class StochasticSoilModelDatabaseReader : SqLiteDatabaseReaderBase
{
private const string databaseRequiredVersion = "15.0.5.0";
@@ -41,6 +46,17 @@
private SQLiteDataReader stochasticSoilProfilesDataReader;
+ ///
+ /// Creates a new instance of ,
+ /// which will use the as its source.
+ ///
+ /// The path of the database file to open.
+ /// Thrown when:
+ /// - The contains invalid characters.
+ /// - No file could be found at .
+ /// - The database version could not be read.
+ /// - The database version is incorrect.
+ ///
public StochasticSoilModelDatabaseReader(string databaseFilePath) : base(databaseFilePath)
{
VerifyVersion();
@@ -53,7 +69,7 @@
/// Thrown when failed to read the database.
public IEnumerable GetStochasticSoilModelSegmentOfPiping()
{
- var stochasticSoilModelSegmentsQuery = DSoilDatabaseQueryBuilder.GetStochasticSoilModelOfMechanismQuery();
+ var stochasticSoilModelSegmentsQuery = SoilDatabaseQueryBuilder.GetStochasticSoilModelOfMechanismQuery();
var sqliteParameter = new SQLiteParameter
{
DbType = DbType.String,
@@ -129,7 +145,7 @@
private bool PrepareStochasticSoilProfilesDataReader()
{
- var stochasticSoilModelSegmentsQuery = DSoilDatabaseQueryBuilder.GetAllStochasticSoilProfileQuery();
+ var stochasticSoilModelSegmentsQuery = SoilDatabaseQueryBuilder.GetAllStochasticSoilProfileQuery();
stochasticSoilProfilesDataReader = CreateDataReader(stochasticSoilModelSegmentsQuery);
if (!stochasticSoilProfilesDataReader.HasRows)
@@ -179,15 +195,22 @@
private static StochasticSoilProfileProbability ReadStochasticSoilProfileProbability(SQLiteDataReader dataReader)
{
var valueSoilProfile1DId = dataReader[StochasticSoilProfileDatabaseColumns.SoilProfile1DId];
- var soilProfile1DId = (valueSoilProfile1DId.Equals(DBNull.Value)) ? (long?) null : Convert.ToInt64(valueSoilProfile1DId);
-
var valueSoilProfile2DId = dataReader[StochasticSoilProfileDatabaseColumns.SoilProfile2DId];
- var soilProfile2DId = (valueSoilProfile2DId.Equals(DBNull.Value)) ? (long?) null : Convert.ToInt64(valueSoilProfile2DId);
-
var valueProbability = dataReader[StochasticSoilProfileDatabaseColumns.Probability];
+
var probability = (valueProbability.Equals(DBNull.Value)) ? 0 : Convert.ToDouble(valueProbability);
- return new StochasticSoilProfileProbability(probability, soilProfile1DId, soilProfile2DId);
+ if (!valueSoilProfile1DId.Equals(DBNull.Value))
+ {
+ var soilProfileId = Convert.ToInt64(valueSoilProfile1DId);
+ return new StochasticSoilProfileProbability(probability, SoilProfileType.SoilProfile1D, soilProfileId);
+ }
+ if (valueSoilProfile2DId.Equals(DBNull.Value))
+ {
+ var soilProfileId = Convert.ToInt64(valueSoilProfile2DId);
+ return new StochasticSoilProfileProbability(probability, SoilProfileType.SoilProfile2D, soilProfileId);
+ }
+ return null;
}
private StochasticSoilModelSegment ReadSoilModels(SQLiteDataReader dataReader)
@@ -200,7 +223,7 @@
private void VerifyVersion()
{
- var checkVersionQuery = DSoilDatabaseQueryBuilder.GetCheckVersionQuery();
+ var checkVersionQuery = SoilDatabaseQueryBuilder.GetCheckVersionQuery();
var sqliteParameter = new SQLiteParameter
{
DbType = DbType.String,
Fisheye: Tag 25dd6ff5b74aec73e47df4488c05439a143711e1 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilModelSegment.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 25dd6ff5b74aec73e47df4488c05439a143711e1 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilProfileProbability.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj
===================================================================
diff -u -rde18e9d8a0324e9345f412eb6c1ffeed4f86f2fb -r25dd6ff5b74aec73e47df4488c05439a143711e1
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision de18e9d8a0324e9345f412eb6c1ffeed4f86f2fb)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -79,6 +79,8 @@
+
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilModelSegmentTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilModelSegmentTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilModelSegmentTest.cs (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -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 StochasticSoilModelSegmentTest
+ {
+ [Test]
+ [TestCase(1234L, "", "")]
+ [TestCase(5678L, "segmentSoilModelName", "segmentName")]
+ public void Constructor_Always_ExpectedValues(long segmentSoilModelId, string segmentSoilModelName, string segmentName)
+ {
+ // Call
+ StochasticSoilModelSegment stochasticSoilModelSegment = new StochasticSoilModelSegment(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.SegmentPoints);
+ CollectionAssert.IsEmpty(stochasticSoilModelSegment.StochasticSoilProfileProbabilities);
+ }
+
+ [Test]
+ public void PropertySegmentPoints_Always_ReturnsExpectedValues()
+ {
+ // Setup
+ const long expectedSegmentSoilModelId = 1234L;
+ const string expectedSegmentSoilModelName = "someSegmentSoilModelName";
+ const string expectedSegmentName = "someSegmentName";
+ StochasticSoilModelSegment stochasticSoilModelSegment = new StochasticSoilModelSegment(expectedSegmentSoilModelId, expectedSegmentSoilModelName, expectedSegmentName);
+ var point2D = new Point2D(1.0, 2.0);
+
+ // Call
+ stochasticSoilModelSegment.SegmentPoints.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]);
+ }
+
+ [Test]
+ public void PropertyStochasticSoilProfileProbabilities_Always_ReturnsExpectedValues()
+ {
+ // Setup
+ const long expectedSegmentSoilModelId = 1234L;
+ const string expectedSegmentSoilModelName = "someSegmentSoilModelName";
+ const string expectedSegmentName = "someSegmentName";
+ StochasticSoilModelSegment stochasticSoilModelSegment = new StochasticSoilModelSegment(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
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileProbabilityTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileProbabilityTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileProbabilityTest.cs (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -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 StochasticSoilProfileProbabilityTest
+ {
+ [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
+ StochasticSoilProfileProbability stochasticSoilProfileProbability = new StochasticSoilProfileProbability(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/Builders/SoilDatabaseQueryBuilderTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilDatabaseQueryBuilderTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilDatabaseQueryBuilderTest.cs (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -0,0 +1,78 @@
+// 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;
+using Ringtoets.Piping.IO.Builders;
+
+namespace Ringtoets.Piping.IO.Test.Builders
+{
+ [TestFixture]
+ public class SoilDatabaseQueryBuilderTest
+ {
+ [Test]
+ public void GetStochasticSoilModelOfMechanismQuery_Always_ReturnsExpectedValues()
+ {
+ // Setup
+ const string expectedQuery = "SELECT SP.XWorld, SP.YWorld, S.SE_Name, SSM.SSM_Name, SSM.SSM_ID " +
+ "FROM Mechanism M " +
+ "INNER JOIN Segment S USING(ME_ID) " +
+ "INNER JOIN StochasticSoilModel SSM USING(SSM_ID) " +
+ "INNER JOIN SegmentPoints SP USING(SE_ID) " +
+ "WHERE M.ME_Name = @ME_Name ORDER BY SSM.SSM_ID;";
+
+ // Call
+ string query = SoilDatabaseQueryBuilder.GetStochasticSoilModelOfMechanismQuery();
+
+ // Assert
+ Assert.AreEqual(expectedQuery, query);
+ }
+
+ [Test]
+ public void GetAllStochasticSoilProfileQuery_Always_ReturnsExpectedValues()
+ {
+ // Setup
+ const string expectedQuery = "SELECT SSM_ID, Probability, SP1D_ID, SP2D_ID " +
+ "FROM StochasticSoilProfile " +
+ "ORDER BY SSM_ID;";
+
+ // Call
+ string query = SoilDatabaseQueryBuilder.GetAllStochasticSoilProfileQuery();
+
+ // Assert
+ Assert.AreEqual(expectedQuery, query);
+ }
+
+ [Test]
+ public void GetCheckVersionQuery_Always_ReturnsExpectedValues()
+ {
+ // Setup
+ const string expectedQuery = "SELECT Value " +
+ "FROM _MetaData " +
+ "WHERE Key = 'VERSION' AND Value = @Value;";
+
+ // Call
+ string query = SoilDatabaseQueryBuilder.GetCheckVersionQuery();
+
+ // Assert
+ Assert.AreEqual(expectedQuery, query);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj
===================================================================
diff -u -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb -r25dd6ff5b74aec73e47df4488c05439a143711e1
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -66,7 +66,7 @@
-
+
Fisheye: Tag 25dd6ff5b74aec73e47df4488c05439a143711e1 refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/DSoilDatabaseQueryBuilderTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilModelDatabaseReaderTest.cs
===================================================================
diff -u -r14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7 -r25dd6ff5b74aec73e47df4488c05439a143711e1
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilModelDatabaseReaderTest.cs (.../StochasticSoilModelDatabaseReaderTest.cs) (revision 14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilModelDatabaseReaderTest.cs (.../StochasticSoilModelDatabaseReaderTest.cs) (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -30,6 +30,7 @@
using Core.Common.TestUtil;
using Core.Common.Utils.Builders;
using NUnit.Framework;
+using Ringtoets.Piping.Data;
using Ringtoets.Piping.IO.Properties;
using Ringtoets.Piping.IO.SoilProfile;
using UtilsResources = Core.Common.Utils.Properties.Resources;
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilModelSegmentTest.cs
===================================================================
diff -u -r14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7 -r25dd6ff5b74aec73e47df4488c05439a143711e1
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilModelSegmentTest.cs (.../StochasticSoilModelSegmentTest.cs) (revision 14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilModelSegmentTest.cs (.../StochasticSoilModelSegmentTest.cs) (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -22,7 +22,7 @@
using Core.Common.Base.Geometry;
using NUnit.Framework;
using Rhino.Mocks;
-using Ringtoets.Piping.IO.SoilProfile;
+using Ringtoets.Piping.Data;
namespace Ringtoets.Piping.IO.Test.SoilProfile
{
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilProfileProbabilityTest.cs
===================================================================
diff -u -r14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7 -r25dd6ff5b74aec73e47df4488c05439a143711e1
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilProfileProbabilityTest.cs (.../StochasticSoilProfileProbabilityTest.cs) (revision 14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/StochasticSoilProfileProbabilityTest.cs (.../StochasticSoilProfileProbabilityTest.cs) (revision 25dd6ff5b74aec73e47df4488c05439a143711e1)
@@ -20,6 +20,7 @@
// All rights reserved.
using NUnit.Framework;
+using Ringtoets.Piping.Data;
using Ringtoets.Piping.IO.SoilProfile;
namespace Ringtoets.Piping.IO.Test.SoilProfile
@@ -28,20 +29,18 @@
public class StochasticSoilProfileProbabilityTest
{
[Test]
- [TestCase(1.0, null, null)]
- [TestCase(2.0, 1234L, null)]
- [TestCase(3.0, 1235L, 5678L)]
- [TestCase(4.0, null, 5679L)]
- public void Constructor_Always_ExpectedValues(double probability, long? soilProfile1DId, long? soilProfile2DId)
+ [TestCase(1.0, SoilProfileType.SoilProfile1D, 123L)]
+ [TestCase(2.0, SoilProfileType.SoilProfile2D, 123L)]
+ public void Constructor_Always_ExpectedValues(double probability, SoilProfileType soilProfileType, long soilProfileId)
{
// Call
- StochasticSoilProfileProbability stochasticSoilProfileProbability = new StochasticSoilProfileProbability(probability, soilProfile1DId, soilProfile2DId);
+ StochasticSoilProfileProbability stochasticSoilProfileProbability = new StochasticSoilProfileProbability(probability, soilProfileType, soilProfileId);
// Assert
Assert.IsInstanceOf(stochasticSoilProfileProbability);
Assert.AreEqual(probability, stochasticSoilProfileProbability.Probability);
- Assert.AreEqual(soilProfile1DId, stochasticSoilProfileProbability.SoilProfile1DId);
- Assert.AreEqual(soilProfile2DId, stochasticSoilProfileProbability.SoilProfile2DId);
+ Assert.AreEqual(soilProfileType, stochasticSoilProfileProbability.SoilProfileType);
+ Assert.AreEqual(soilProfileId, stochasticSoilProfileProbability.SoilProfileId);
}
}
}
\ No newline at end of file