Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfile.cs =================================================================== diff -u -rdc324dd8b87bdcef3d6ed1c0a8f7ee721ffadfbd -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision dc324dd8b87bdcef3d6ed1c0a8f7ee721ffadfbd) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -40,16 +40,23 @@ /// The name of the profile. /// The bottom level of the profile. /// The collection of layers that should be part of the profile. + /// Identifier of the profile. /// Thrown when contains no layers. /// Thrown when is null. - public PipingSoilProfile(string name, double bottom, IEnumerable layers) + public PipingSoilProfile(string name, double bottom, IEnumerable layers, long pipingSoilProfileId) { Name = name; Bottom = bottom; Layers = layers; + PipingSoilProfileId = pipingSoilProfileId; } /// + /// Gets the database identifier of the . + /// + public long PipingSoilProfileId { get; private set; } + + /// /// Gets the bottom level of the . /// public double Bottom { get; private set; } @@ -79,34 +86,6 @@ } /// - /// Validates the given . A valid has layers which - /// all have values for which are greater than or equal to . - /// - /// The collection of to validate. - /// Thrown when is null. - /// Thrown when - /// - /// contains no layers - /// contains a layer with the less than - /// - /// - private void ValidateLayersCollection(IEnumerable collection) - { - if (collection == null) - { - throw new ArgumentNullException(@"collection", string.Format(Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers)); - } - if (!collection.Any()) - { - throw new ArgumentException(Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers); - } - if (collection.Any(l => l.Top < Bottom)) - { - throw new ArgumentException(Resources.PipingSoilProfile_Layers_Layer_top_below_profile_bottom); - } - } - - /// /// Gets the thickness of the given layer in the . /// Thickness of a layer is determined by its top and the top of the layer below it. /// @@ -128,11 +107,6 @@ throw new ArgumentException("Layer not found in profile."); } - public override string ToString() - { - return Name; - } - /// /// Retrieves the thickness of the topmost aquifer layer under a certain . /// Only the thickness of the part of the aquifer layer under the level is determined. @@ -164,6 +138,39 @@ return GetLayerThicknessBelowLevel(currentTopAquiferLayer, level); } + public override string ToString() + { + return Name; + } + + /// + /// Validates the given . A valid has layers which + /// all have values for which are greater than or equal to . + /// + /// The collection of to validate. + /// Thrown when is null. + /// Thrown when + /// + /// contains no layers + /// contains a layer with the less than + /// + /// + private void ValidateLayersCollection(IEnumerable collection) + { + if (collection == null) + { + throw new ArgumentNullException(@"collection", string.Format(Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers)); + } + if (!collection.Any()) + { + throw new ArgumentException(Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers); + } + if (collection.Any(l => l.Top < Bottom)) + { + throw new ArgumentException(Resources.PipingSoilProfile_Layers_Layer_top_below_profile_bottom); + } + } + private void ValidateLevelToBottom(double level) { if (level < Bottom) Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilProfileBuilder1D.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilProfileBuilder1D.cs (.../SoilProfileBuilder1D.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilProfileBuilder1D.cs (.../SoilProfileBuilder1D.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -33,11 +33,13 @@ private readonly Collection layers; private readonly string name; private readonly double bottom; + private readonly long soilProfileId; - internal SoilProfileBuilder1D(string name, double bottom) + internal SoilProfileBuilder1D(string name, double bottom, long soilProfileId) { this.name = name; this.bottom = bottom; + this.soilProfileId = soilProfileId; layers = new Collection(); } @@ -50,7 +52,7 @@ { try { - return new PipingSoilProfile(name, bottom, layers); + return new PipingSoilProfile(name, bottom, layers, soilProfileId); } catch (ArgumentException e) { Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilProfileBuilder2D.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilProfileBuilder2D.cs (.../SoilProfileBuilder2D.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Builders/SoilProfileBuilder2D.cs (.../SoilProfileBuilder2D.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -35,6 +35,7 @@ private readonly ICollection layers = new Collection(); private readonly double atX; private readonly string profileName; + private readonly long soilProfileId; private double bottom; @@ -44,18 +45,20 @@ /// /// The name for the constructed by the . /// The x position from which to obtain a 1D profile. + /// The indentifier of the profile in the database. /// Thrown when can not be used to determine intersections with /// (is ). - internal SoilProfileBuilder2D(string profileName, double atX) + internal SoilProfileBuilder2D(string profileName, double atX, long soilProfileId) { if (double.IsNaN(atX)) { - var message = string.Format(Resources.Error_SoilProfileBuilder_cant_determine_intersect_SoilProfileName_0_at_double_NaN , profileName); + var message = string.Format(Resources.Error_SoilProfileBuilder_cant_determine_intersect_SoilProfileName_0_at_double_NaN, profileName); throw new ArgumentException(message); } this.profileName = profileName; this.atX = atX; bottom = double.MaxValue; + this.soilProfileId = soilProfileId; } /// @@ -69,7 +72,7 @@ { try { - return new PipingSoilProfile(profileName, bottom, layers); + return new PipingSoilProfile(profileName, bottom, layers, soilProfileId); } catch (ArgumentException e) { Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj =================================================================== diff -u -r14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision 14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -48,7 +48,7 @@ - + Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/CriticalProfileProperties.cs =================================================================== diff -u -r98fc85d8cecf9edae9fe7c1f2f47b60ecda5e187 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/CriticalProfileProperties.cs (.../CriticalProfileProperties.cs) (revision 98fc85d8cecf9edae9fe7c1f2f47b60ecda5e187) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/CriticalProfileProperties.cs (.../CriticalProfileProperties.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -47,6 +47,7 @@ { ProfileName = reader.Read(SoilProfileDatabaseColumns.ProfileName); LayerCount = reader.Read(SoilProfileDatabaseColumns.LayerCount); + ProfileId = reader.Read(SoilProfileDatabaseColumns.SoilProfileId); } catch (InvalidCastException e) { @@ -69,5 +70,10 @@ /// The number of layers that the profile to read has /// internal long LayerCount { get; private set; } + + /// + /// Gets the database identifier of the profile. + /// + internal long ProfileId { get; private set; } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/DSoilDatabaseQueryBuilder.cs =================================================================== diff -u --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/DSoilDatabaseQueryBuilder.cs (revision 0) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/DSoilDatabaseQueryBuilder.cs (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -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 System; + +namespace Ringtoets.Piping.IO.SoilProfile +{ + /// + /// Defines queries to execute on the DSoil-Model database. + /// + public static class DSoilDatabaseQueryBuilder + { + /// + /// Returns the SQL query to execute to fetch Stochastic Soil Models + /// of the Piping Mechanism from the DSoil-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 DSoil-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 DSoil-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 Fisheye: Tag fab2798bdc0feb4454b6384aefbe9db3f9a294fb refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/DSoilQueryBuilder.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/MechanismDatabaseColumns.cs =================================================================== diff -u -r14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/MechanismDatabaseColumns.cs (.../MechanismDatabaseColumns.cs) (revision 14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/MechanismDatabaseColumns.cs (.../MechanismDatabaseColumns.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -21,6 +21,10 @@ namespace Ringtoets.Piping.IO.SoilProfile { + /// + /// This class contains the names of the table and columns of the table + /// 'Mechanism' of the DSoil-Model database. + /// internal static class MechanismDatabaseColumns { internal const string TableName = "Mechanism"; Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/MetaDataDatabaseColumns.cs =================================================================== diff -u -r14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/MetaDataDatabaseColumns.cs (.../MetaDataDatabaseColumns.cs) (revision 14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/MetaDataDatabaseColumns.cs (.../MetaDataDatabaseColumns.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -1,5 +1,30 @@ -namespace Ringtoets.Piping.IO.SoilProfile +// 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.IO.SoilProfile { + /// + /// This class contains the names of the table and columns of the table + /// '_MetaData' of the DSoil-Model database. + /// internal static class MetaDataDatabaseColumns { internal const string TableName = "_MetaData"; Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/PipingSoilProfileReader.cs =================================================================== diff -u -r733d0d51adf737c52704cd80705507fdb34a2ba3 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/PipingSoilProfileReader.cs (.../PipingSoilProfileReader.cs) (revision 733d0d51adf737c52704cd80705507fdb34a2ba3) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/PipingSoilProfileReader.cs (.../PipingSoilProfileReader.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -287,12 +287,13 @@ "{5},", "{6},", "{7},", - "{8}", + "{8},", + "p.SP1D_ID as {9}", "FROM SoilProfile1D as p", - "JOIN {9}", + "JOIN {10}", "JOIN SoilLayer1D as l ON l.SP1D_ID = p.SP1D_ID", - "LEFT JOIN {10}", "LEFT JOIN {11}", + "LEFT JOIN {12}", "ORDER BY ProfileName;"), SoilProfileDatabaseColumns.Dimension, SoilProfileDatabaseColumns.ProfileName, @@ -303,6 +304,7 @@ SoilProfileDatabaseColumns.BelowPhreaticLevel, SoilProfileDatabaseColumns.DryUnitWeight, SoilProfileDatabaseColumns.IsAquifer, + SoilProfileDatabaseColumns.SoilProfileId, layer1DCountQuery, materialPropertiesQuery, layer1DPropertiesQuery); @@ -318,15 +320,16 @@ "{5},", "{6},", "{7},", - "{8}", + "{8},", + "p.SP2D_ID as {9}", "FROM Mechanism as m", "JOIN MechanismPointLocation as mpl ON mpl.ME_ID = m.ME_ID", "JOIN SoilProfile2D as p ON p.SP2D_ID = mpl.SP2D_ID", - "JOIN {9}", + "JOIN {10}", "JOIN SoilLayer2D as l ON l.SP2D_ID = p.SP2D_ID", - "LEFT JOIN {10}", "LEFT JOIN {11}", - "WHERE m.ME_Name = @{12}", + "LEFT JOIN {12}", + "WHERE m.ME_Name = @{13}", "ORDER BY ProfileName;"), SoilProfileDatabaseColumns.Dimension, SoilProfileDatabaseColumns.ProfileName, @@ -337,6 +340,7 @@ SoilProfileDatabaseColumns.BelowPhreaticLevel, SoilProfileDatabaseColumns.DryUnitWeight, SoilProfileDatabaseColumns.IsAquifer, + SoilProfileDatabaseColumns.SoilProfileId, layer2DCountQuery, materialPropertiesQuery, layer2DPropertiesQuery, Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SegmentDatabaseColumns.cs =================================================================== diff -u -r14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SegmentDatabaseColumns.cs (.../SegmentDatabaseColumns.cs) (revision 14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SegmentDatabaseColumns.cs (.../SegmentDatabaseColumns.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -21,12 +21,13 @@ namespace Ringtoets.Piping.IO.SoilProfile { + /// + /// This class contains the names of the table and columns of the table + /// 'Segment' of the DSoil-Model database. + /// internal static class SegmentDatabaseColumns { internal const string TableName = "Segment"; - internal const string SegmentId = "SE_ID"; - internal const string StochasticSoilModelId = "SSM_ID"; - internal const string MechanismId = "ME_ID"; internal const string SegmentName = "SE_Name"; } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SegmentPointsDatabaseColumns.cs =================================================================== diff -u -r14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SegmentPointsDatabaseColumns.cs (.../SegmentPointsDatabaseColumns.cs) (revision 14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SegmentPointsDatabaseColumns.cs (.../SegmentPointsDatabaseColumns.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -21,10 +21,13 @@ namespace Ringtoets.Piping.IO.SoilProfile { + /// + /// This class contains the names of the table and columns of the table + /// 'SegmentPoints' of the DSoil-Model database. + /// internal static class SegmentPointsDatabaseColumns { internal const string TableName = "SegmentPoints"; - internal const string SegmentPointsId = "SEGP_ID"; internal const string SegmentId = "SE_ID"; internal const string CoordinateX = "XWorld"; internal const string CoordinateY = "YWorld"; Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilProfile1DReader.cs =================================================================== diff -u -r98fc85d8cecf9edae9fe7c1f2f47b60ecda5e187 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilProfile1DReader.cs (.../SoilProfile1DReader.cs) (revision 98fc85d8cecf9edae9fe7c1f2f47b60ecda5e187) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilProfile1DReader.cs (.../SoilProfile1DReader.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -47,10 +47,11 @@ { var criticalProperties = new CriticalProfileProperties(reader); + var profileId = criticalProperties.ProfileId; var profileName = criticalProperties.ProfileName; var requiredProperties = new RequiredProfileProperties(reader, profileName); - var soilProfileBuilder = new SoilProfileBuilder1D(profileName, requiredProperties.Bottom); + var soilProfileBuilder = new SoilProfileBuilder1D(profileName, requiredProperties.Bottom, profileId); for (var i = 1; i <= criticalProperties.LayerCount; i++) { Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilProfile2DReader.cs =================================================================== diff -u -r98fc85d8cecf9edae9fe7c1f2f47b60ecda5e187 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilProfile2DReader.cs (.../SoilProfile2DReader.cs) (revision 98fc85d8cecf9edae9fe7c1f2f47b60ecda5e187) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilProfile2DReader.cs (.../SoilProfile2DReader.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -57,7 +57,7 @@ try { - var soilProfileBuilder = new SoilProfileBuilder2D(criticalProperties.ProfileName, requiredProperties.IntersectionX); + var soilProfileBuilder = new SoilProfileBuilder2D(criticalProperties.ProfileName, requiredProperties.IntersectionX, criticalProperties.ProfileId); for (int i = 1; i <= criticalProperties.LayerCount; i++) { Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilProfileDatabaseColumns.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilProfileDatabaseColumns.cs (.../SoilProfileDatabaseColumns.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/SoilProfileDatabaseColumns.cs (.../SoilProfileDatabaseColumns.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -26,6 +26,7 @@ /// internal static class SoilProfileDatabaseColumns { + internal const string SoilProfileId = "SoilProfileId"; internal const string ProfileCount = "ProfileCount"; internal const string Dimension = "Dimension"; internal const string IsAquifer = "IsAquifer"; Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilModelDatabaseReader.cs =================================================================== diff -u -r14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilModelDatabaseReader.cs (.../StochasticSoilModelDatabaseReader.cs) (revision 14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilModelDatabaseReader.cs (.../StochasticSoilModelDatabaseReader.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -53,7 +53,7 @@ /// Thrown when failed to read the database. public IEnumerable GetStochasticSoilModelSegmentOfPiping() { - var stochasticSoilModelSegmentsQuery = DSoilQueryBuilder.GetStochasticSoilModelOfPipingMechanismQuery(); + var stochasticSoilModelSegmentsQuery = DSoilDatabaseQueryBuilder.GetStochasticSoilModelOfMechanismQuery(); var sqliteParameter = new SQLiteParameter { DbType = DbType.String, @@ -129,7 +129,7 @@ private bool PrepareStochasticSoilProfilesDataReader() { - var stochasticSoilModelSegmentsQuery = DSoilQueryBuilder.GetAllStochasticSoilProfileQuery(); + var stochasticSoilModelSegmentsQuery = DSoilDatabaseQueryBuilder.GetAllStochasticSoilProfileQuery(); stochasticSoilProfilesDataReader = CreateDataReader(stochasticSoilModelSegmentsQuery); if (!stochasticSoilProfilesDataReader.HasRows) @@ -200,7 +200,7 @@ private void VerifyVersion() { - var checkVersionQuery = DSoilQueryBuilder.GetCheckVersionQuery(); + var checkVersionQuery = DSoilDatabaseQueryBuilder.GetCheckVersionQuery(); var sqliteParameter = new SQLiteParameter { DbType = DbType.String, Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilProfileDatabaseColumns.cs =================================================================== diff -u -r14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilProfileDatabaseColumns.cs (.../StochasticSoilProfileDatabaseColumns.cs) (revision 14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilProfileDatabaseColumns.cs (.../StochasticSoilProfileDatabaseColumns.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -21,6 +21,10 @@ namespace Ringtoets.Piping.IO.SoilProfile { + /// + /// This class contains the names of the table and columns of the table + /// 'StochasticSoilProfile' of the DSoil-Model database. + /// internal static class StochasticSoilProfileDatabaseColumns { internal const string TableName = "StochasticSoilProfile"; Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorInputTest.cs =================================================================== diff -u -rc0a3ced404197fd781c6fcbcfc21c6676592be57 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorInputTest.cs (.../PipingCalculatorInputTest.cs) (revision c0a3ced404197fd781c6fcbcfc21c6676592be57) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorInputTest.cs (.../PipingCalculatorInputTest.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -1,7 +1,5 @@ using System; - using NUnit.Framework; - using Ringtoets.Piping.Data; namespace Ringtoets.Piping.Calculation.Test @@ -36,13 +34,13 @@ double beddingAngleValue = random.NextDouble(); double exitPointXCoordinate = random.NextDouble(); var surfaceLine = new RingtoetsPipingSurfaceLine(); - var soilProfile = new PipingSoilProfile(string.Empty, random.NextDouble(), new [] + var soilProfile = new PipingSoilProfile(string.Empty, random.NextDouble(), new[] { new PipingSoilLayer(random.NextDouble()) { IsAquifer = true - } - }); + } + }, 0); var input = new PipingCalculatorInput( volumetricWeightOfWaterValue, @@ -67,7 +65,7 @@ meanDiameter70Value, beddingAngleValue, exitPointXCoordinate, - surfaceLine, + surfaceLine, soilProfile); Assert.AreEqual(volumetricWeightOfWaterValue, input.WaterVolumetricWeight); Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorTest.cs =================================================================== diff -u -r8b85f978c7bbe5c29a6ada6509f14d0462b8b9c3 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorTest.cs (.../PipingCalculatorTest.cs) (revision 8b85f978c7bbe5c29a6ada6509f14d0462b8b9c3) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorTest.cs (.../PipingCalculatorTest.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -309,7 +309,7 @@ SoilProfile = new PipingSoilProfile(String.Empty, bottom, new[] { new PipingSoilLayer(top) - }) + }, 0) }.AsRealInput(); var calculation = new PipingCalculator(input, new PipingSubCalculatorFactory()); @@ -332,7 +332,7 @@ SoilProfile = new PipingSoilProfile(String.Empty, -1.0, new[] { new PipingSoilLayer(0) - }) + }, 0) }.AsRealInput(); var calculation = new PipingCalculator(input, new PipingSubCalculatorFactory()); Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingProfileCreatorTest.cs =================================================================== diff -u -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingProfileCreatorTest.cs (.../PipingProfileCreatorTest.cs) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingProfileCreatorTest.cs (.../PipingProfileCreatorTest.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -2,11 +2,8 @@ using System.Collections; using System.Collections.Generic; using System.Linq; - using Deltares.WTIPiping; - using NUnit.Framework; - using Ringtoets.Piping.Data; namespace Ringtoets.Piping.Calculation.Test @@ -23,17 +20,18 @@ var belowPhreaticLevel = random.NextDouble(); var abovePhreaticLevel = random.NextDouble(); var dryUnitWeight = random.NextDouble(); - IEnumerable layers = new [] + const long pipingSoilProfileId = 1234L; + IEnumerable layers = new[] { new PipingSoilLayer(expectedTop) { IsAquifer = true, BelowPhreaticLevel = belowPhreaticLevel, AbovePhreaticLevel = abovePhreaticLevel, DryUnitWeight = dryUnitWeight - }, + }, }; - var soilProfile = new PipingSoilProfile(String.Empty, expectedBottom, layers); + var soilProfile = new PipingSoilProfile(String.Empty, expectedBottom, layers, pipingSoilProfileId); // Call PipingProfile actual = PipingProfileCreator.Create(soilProfile); @@ -52,6 +50,7 @@ Assert.AreEqual(belowPhreaticLevel, pipingLayer.BelowPhreaticLevel); Assert.AreEqual(abovePhreaticLevel, pipingLayer.AbovePhreaticLevel); Assert.AreEqual(dryUnitWeight, pipingLayer.DryUnitWeight); + Assert.AreEqual(pipingSoilProfileId, soilProfile.PipingSoilProfileId); } [Test] @@ -63,6 +62,7 @@ var expectedTopB = expectedTopA - random.NextDouble(); var expectedTopC = expectedTopB - random.NextDouble(); var expectedBottom = expectedTopC - random.NextDouble(); + const long pipingSoilProfileId = 1234L; IEnumerable layers = new[] { new PipingSoilLayer(expectedTopA) @@ -73,7 +73,7 @@ new PipingSoilLayer(expectedTopC) }; - var soilProfile = new PipingSoilProfile(String.Empty, expectedBottom, layers); + var soilProfile = new PipingSoilProfile(String.Empty, expectedBottom, layers, pipingSoilProfileId); // Call PipingProfile actual = PipingProfileCreator.Create(soilProfile); @@ -87,8 +87,14 @@ false, }; CollectionAssert.AreEqual(expectedAquifers, actual.Layers.Select(l => l.IsAquifer)); - CollectionAssert.AreEqual(new[] { expectedTopA, expectedTopB, expectedTopC }, actual.Layers.Select(l => l.TopLevel)); + CollectionAssert.AreEqual(new[] + { + expectedTopA, + expectedTopB, + expectedTopC + }, actual.Layers.Select(l => l.TopLevel)); Assert.AreEqual(expectedBottom, actual.BottomLevel); + Assert.AreEqual(pipingSoilProfileId, soilProfile.PipingSoilProfileId); } [Test] @@ -100,16 +106,17 @@ var expectedTopB = random.NextDouble() + expectedTopA; var expectedTopC = random.NextDouble() + expectedTopB; var expectedBottom = expectedTopA - random.NextDouble(); + const long pipingSoilProfileId = 1234L; IEnumerable layers = new[] { new PipingSoilLayer(expectedTopA) { IsAquifer = true - }, - new PipingSoilLayer(expectedTopB), - new PipingSoilLayer(expectedTopC) + }, + new PipingSoilLayer(expectedTopB), + new PipingSoilLayer(expectedTopC) }; - var soilProfile = new PipingSoilProfile(string.Empty, expectedBottom, layers); + var soilProfile = new PipingSoilProfile(string.Empty, expectedBottom, layers, pipingSoilProfileId); // Precondition CollectionAssert.AreNotEqual(layers, layers.OrderByDescending(l => l.Top), "Layer collection should not be in descending order by the Top property."); @@ -127,11 +134,16 @@ false, false, true, - }; CollectionAssert.AreEqual(expectedAquifers, actual.Layers.Select(l => l.IsAquifer)); - CollectionAssert.AreEqual(new []{ expectedTopC, expectedTopB, expectedTopA }, actual.Layers.Select(l => l.TopLevel)); + CollectionAssert.AreEqual(new[] + { + expectedTopC, + expectedTopB, + expectedTopA + }, actual.Layers.Select(l => l.TopLevel)); Assert.AreEqual(expectedBottom, actual.BottomLevel); + Assert.AreEqual(pipingSoilProfileId, soilProfile.PipingSoilProfileId); } [Test] @@ -148,17 +160,17 @@ new PipingSoilLayer(1) { BelowPhreaticLevel = levelA - }, + }, new PipingSoilLayer(0) { BelowPhreaticLevel = levelB - }, - new PipingSoilLayer(-1) + }, + new PipingSoilLayer(-1) { BelowPhreaticLevel = levelC } }; - var soilProfile = new PipingSoilProfile(string.Empty, -2, layers); + var soilProfile = new PipingSoilProfile(string.Empty, -2, layers, 0); // Call PipingProfile actual = PipingProfileCreator.Create(soilProfile); @@ -185,17 +197,17 @@ new PipingSoilLayer(1) { AbovePhreaticLevel = levelA - }, + }, new PipingSoilLayer(0) { AbovePhreaticLevel = levelB - }, - new PipingSoilLayer(-1) + }, + new PipingSoilLayer(-1) { AbovePhreaticLevel = levelC } }; - var soilProfile = new PipingSoilProfile(string.Empty, -2, layers); + var soilProfile = new PipingSoilProfile(string.Empty, -2, layers, 0); // Call PipingProfile actual = PipingProfileCreator.Create(soilProfile); @@ -226,13 +238,13 @@ new PipingSoilLayer(0) { DryUnitWeight = weightB - }, + }, new PipingSoilLayer(-1) { DryUnitWeight = weightC - } + } }; - var soilProfile = new PipingSoilProfile(string.Empty, -2, layers); + var soilProfile = new PipingSoilProfile(string.Empty, -2, layers, 0); // Call PipingProfile actual = PipingProfileCreator.Create(soilProfile); Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingInput.cs =================================================================== diff -u -r8b85f978c7bbe5c29a6ada6509f14d0462b8b9c3 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingInput.cs (.../TestPipingInput.cs) (revision 8b85f978c7bbe5c29a6ada6509f14d0462b8b9c3) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingInput.cs (.../TestPipingInput.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -1,14 +1,13 @@ using System; - using Core.Common.Base.Data; using Core.Common.Base.Geometry; - using Ringtoets.Piping.Data; namespace Ringtoets.Piping.Calculation.TestUtil { public class TestPipingInput { + private readonly Random random = new Random(22); public double WaterVolumetricWeight; public double SaturatedVolumicWeightOfCoverageLayer; public double UpliftModelFactor; @@ -33,17 +32,15 @@ public double ThicknessAquiferLayer; public RingtoetsPipingSurfaceLine SurfaceLine; public PipingSoilProfile SoilProfile; - - private readonly Random random = new Random(22); private double last; public TestPipingInput() { WaterVolumetricWeight = NextIncrementalDouble(); SaturatedVolumicWeightOfCoverageLayer = NextIncrementalDouble(); UpliftModelFactor = NextIncrementalDouble(); - AssessmentLevel = (RoundedDouble)NextIncrementalDouble(); - PiezometricHeadExit = (RoundedDouble)NextIncrementalDouble(); + AssessmentLevel = (RoundedDouble) NextIncrementalDouble(); + PiezometricHeadExit = (RoundedDouble) NextIncrementalDouble(); PhreaticLevelExit = NextIncrementalDouble(); DampingFactorExit = NextIncrementalDouble(); CriticalHeaveGradient = NextIncrementalDouble(); @@ -65,41 +62,7 @@ SoilProfile = CreateValidSoilProfile(); } - private PipingSoilProfile CreateValidSoilProfile() - { - return new PipingSoilProfile(String.Empty, -2, new [] - { - new PipingSoilLayer(9), - new PipingSoilLayer(4) - { - IsAquifer = true - }, - new PipingSoilLayer(2), - new PipingSoilLayer(-1), - }); - } - - private RingtoetsPipingSurfaceLine CreateValidSurfaceLine() - { - var ringtoetsPipingSurfaceLine = new RingtoetsPipingSurfaceLine(); - ringtoetsPipingSurfaceLine.SetGeometry(new[] - { - new Point3D (0, 0, 2), - new Point3D (1, 0, 8), - new Point3D (2, 0, -1) - }); - return ringtoetsPipingSurfaceLine; - } - /// - /// The returned double is sure to be different from the last time it was called. - /// - private double NextIncrementalDouble() - { - return last += random.NextDouble() + 1e-6; - } - - /// /// Returns the current set value as a /// public PipingCalculatorInput AsRealInput() @@ -127,8 +90,42 @@ MeanDiameter70, BeddingAngle, ExitPointXCoordinate, - SurfaceLine, + SurfaceLine, SoilProfile); } + + private PipingSoilProfile CreateValidSoilProfile() + { + return new PipingSoilProfile(String.Empty, -2, new[] + { + new PipingSoilLayer(9), + new PipingSoilLayer(4) + { + IsAquifer = true + }, + new PipingSoilLayer(2), + new PipingSoilLayer(-1), + }, 1234L); + } + + private RingtoetsPipingSurfaceLine CreateValidSurfaceLine() + { + var ringtoetsPipingSurfaceLine = new RingtoetsPipingSurfaceLine(); + ringtoetsPipingSurfaceLine.SetGeometry(new[] + { + new Point3D(0, 0, 2), + new Point3D(1, 0, 8), + new Point3D(2, 0, -1) + }); + return ringtoetsPipingSurfaceLine; + } + + /// + /// The returned double is sure to be different from the last time it was called. + /// + private double NextIncrementalDouble() + { + return last += random.NextDouble() + 1e-6; + } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingSoilProfile.cs =================================================================== diff -u -r2a49b7243807fe0b95136efd55652201164a6c74 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingSoilProfile.cs (.../TestPipingSoilProfile.cs) (revision 2a49b7243807fe0b95136efd55652201164a6c74) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingSoilProfile.cs (.../TestPipingSoilProfile.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -21,6 +21,6 @@ { IsAquifer = true } - }) {} + }, 0) {} } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs =================================================================== diff -u -rdc324dd8b87bdcef3d6ed1c0a8f7ee721ffadfbd -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs (.../PipingSoilProfileTest.cs) (revision dc324dd8b87bdcef3d6ed1c0a8f7ee721ffadfbd) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs (.../PipingSoilProfileTest.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -4,6 +4,7 @@ using System.Linq; using Core.Common.TestUtil; using NUnit.Framework; +using Ringtoets.Piping.Data.Properties; namespace Ringtoets.Piping.Data.Test { @@ -20,34 +21,36 @@ { new PipingSoilLayer(bottom) }; + const long pipingSoilProfileId = 1234L; // Call - var profile = new PipingSoilProfile(name, bottom, layers); + var profile = new PipingSoilProfile(name, bottom, layers, pipingSoilProfileId); // Assert Assert.AreNotSame(layers, profile.Layers); Assert.AreEqual(name, profile.Name); Assert.AreEqual(bottom, profile.Bottom); + Assert.AreEqual(pipingSoilProfileId, profile.PipingSoilProfileId); } [Test] public void Constructor_WithNameBottomLayersEmpty_ThrowsArgumentException() { // Call - TestDelegate test = () => new PipingSoilProfile(String.Empty, Double.NaN, new Collection()); + TestDelegate test = () => new PipingSoilProfile(String.Empty, Double.NaN, new Collection(), 0); // Assert - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, Properties.Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers); + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers); } [Test] public void Constructor_WithNameBottomLayersNull_ThrowsArgumentNullException() { // Call - TestDelegate test = () => new PipingSoilProfile(String.Empty, Double.NaN, null); + TestDelegate test = () => new PipingSoilProfile(String.Empty, Double.NaN, null, 0); // Assert - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, Properties.Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers); + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, Resources.Error_Cannot_Construct_PipingSoilProfile_Without_Layers); } [Test] @@ -68,7 +71,7 @@ }); } - var profile = new PipingSoilProfile(string.Empty, bottom, equivalentLayers); + var profile = new PipingSoilProfile(string.Empty, bottom, equivalentLayers, 0); // Call var result = profile.Layers.ToArray(); @@ -92,15 +95,15 @@ }; // Call - TestDelegate test = () => new PipingSoilProfile(String.Empty, bottom, pipingSoilLayers); + TestDelegate test = () => new PipingSoilProfile(String.Empty, bottom, pipingSoilLayers, 0); // Assert TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "Eén of meerdere lagen hebben een top onder de bodem van het profiel."); } [Test] - [TestCase(0,0)] - [TestCase(1,1.1)] + [TestCase(0, 0)] + [TestCase(1, 1.1)] public void GetLayerThickness_LayerInProfile_ReturnsThicknessOfLayer(int layerIndex, double expectedThickness) { // Setup @@ -109,7 +112,7 @@ new PipingSoilLayer(0.0), new PipingSoilLayer(1.1) }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers); + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, 0); // Call var thickness = profile.GetLayerThickness(pipingSoilLayers[layerIndex]); @@ -127,10 +130,10 @@ new PipingSoilLayer(0.0), new PipingSoilLayer(1.1) }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers); + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, 0); // Call - TestDelegate test = () => profile.GetLayerThickness(new PipingSoilLayer(1.1)); + TestDelegate test = () => profile.GetLayerThickness(new PipingSoilLayer(1.1)); // Assert TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "Layer not found in profile."); @@ -145,7 +148,7 @@ new PipingSoilLayer(2.1), new PipingSoilLayer(1.1) }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers); + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, 0); // Call var result = profile.GetTopAquiferLayerThicknessBelowLevel(1.0); @@ -166,7 +169,7 @@ }, new PipingSoilLayer(1.1) }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers); + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, 0); // Call var result = profile.GetTopAquiferLayerThicknessBelowLevel(1.0); @@ -186,7 +189,7 @@ IsAquifer = true }, }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers); + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, 0); // Call var result = profile.GetTopAquiferLayerThicknessBelowLevel(2.2); @@ -206,7 +209,7 @@ IsAquifer = true }, }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers); + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, 0); // Call var result = profile.GetTopAquiferLayerThicknessBelowLevel(1.6); @@ -226,7 +229,7 @@ IsAquifer = true }, }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers); + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, 0); // Call var result = profile.GetTopAquiferLayerThicknessBelowLevel(1.6); @@ -250,7 +253,7 @@ IsAquifer = true } }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers); + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, 0); // Call var result = profile.GetTopAquiferLayerThicknessBelowLevel(2.2); @@ -274,7 +277,7 @@ IsAquifer = true } }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers); + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, 0); // Call var result = profile.GetTopAquiferLayerThicknessBelowLevel(2.1); @@ -302,7 +305,7 @@ IsAquifer = true } }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers); + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, 0); // Call var result = profile.GetTopAquiferLayerThicknessBelowLevel(1.3); @@ -326,7 +329,7 @@ IsAquifer = true } }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers); + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, 0); // Call var result = profile.GetTopAquiferLayerThicknessBelowLevel(1.5); @@ -354,7 +357,7 @@ IsAquifer = false } }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers); + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, 0); // Call var result = profile.GetTopAquiferLayerThicknessBelowLevel(0.5); @@ -378,7 +381,7 @@ IsAquifer = true }, }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers); + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, 0); // Call var result = profile.GetTopAquiferLayerThicknessBelowLevel(1.1); @@ -398,7 +401,7 @@ IsAquifer = true } }; - var profile = new PipingSoilProfile(string.Empty, 0.5, pipingSoilLayers); + var profile = new PipingSoilProfile(string.Empty, 0.5, pipingSoilLayers, 0); // Call TestDelegate call = () => profile.GetTopAquiferLayerThicknessBelowLevel(0.0); @@ -418,7 +421,7 @@ var profile = new PipingSoilProfile(name, 0.0, new[] { new PipingSoilLayer(0.0) - }); + }, 0); // Call & Assert Assert.AreEqual(name, profile.ToString()); Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingCalculationFactory.cs =================================================================== diff -u -rde18e9d8a0324e9345f412eb6c1ffeed4f86f2fb -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingCalculationFactory.cs (.../PipingCalculationFactory.cs) (revision de18e9d8a0324e9345f412eb6c1ffeed4f86f2fb) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingCalculationFactory.cs (.../PipingCalculationFactory.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -1,5 +1,4 @@ using System; - using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Ringtoets.HydraRing.Data; @@ -24,21 +23,21 @@ { IsAquifer = true } - }); + }, 0); var surfaceLine = new RingtoetsPipingSurfaceLine(); - var firstCharacteristicPointLocation = new Point3D(0.2, 0.0, top / 6); - var secondCharacteristicPointLocation = new Point3D(0.3, 0.0, 2 * top / 6); - var thirdCharacteristicPointLocation = new Point3D(0.4, 0.0, 3 * top / 6); - var fourthCharacteristicPointLocation = new Point3D(0.5, 0.0, 4 * top / 6); - var fifthCharacteristicPointLocation = new Point3D(0.6, 0.0, 5 * top / 6); - surfaceLine.SetGeometry(new [] + var firstCharacteristicPointLocation = new Point3D(0.2, 0.0, top/6); + var secondCharacteristicPointLocation = new Point3D(0.3, 0.0, 2*top/6); + var thirdCharacteristicPointLocation = new Point3D(0.4, 0.0, 3*top/6); + var fourthCharacteristicPointLocation = new Point3D(0.5, 0.0, 4*top/6); + var fifthCharacteristicPointLocation = new Point3D(0.6, 0.0, 5*top/6); + surfaceLine.SetGeometry(new[] { - new Point3D(0.0, 0.0, 0.0), - firstCharacteristicPointLocation, - secondCharacteristicPointLocation, - thirdCharacteristicPointLocation, - fourthCharacteristicPointLocation, - fifthCharacteristicPointLocation, + new Point3D(0.0, 0.0, 0.0), + firstCharacteristicPointLocation, + secondCharacteristicPointLocation, + thirdCharacteristicPointLocation, + fourthCharacteristicPointLocation, + fifthCharacteristicPointLocation, new Point3D(1.0, 0.0, top) }); surfaceLine.SetDikeToeAtPolderAt(firstCharacteristicPointLocation); @@ -57,34 +56,34 @@ { DampingFactorExit = { - Mean = (RoundedDouble)1.0 + Mean = (RoundedDouble) 1.0 }, DarcyPermeability = { - Mean = (RoundedDouble)1.0 + Mean = (RoundedDouble) 1.0 }, Diameter70 = { - Mean = (RoundedDouble)1.0 + Mean = (RoundedDouble) 1.0 }, - ExitPointL = (RoundedDouble)1.0, + ExitPointL = (RoundedDouble) 1.0, PhreaticLevelExit = { - Mean = (RoundedDouble)2.0 + Mean = (RoundedDouble) 2.0 }, SeepageLength = { - Mean = (RoundedDouble)1.0 + Mean = (RoundedDouble) 1.0 }, ThicknessAquiferLayer = { - Mean = (RoundedDouble)1.0 + Mean = (RoundedDouble) 1.0 }, ThicknessCoverageLayer = { - Mean = (RoundedDouble)1.0 + Mean = (RoundedDouble) 1.0 }, - PiezometricHeadExit = (RoundedDouble)2.1, + PiezometricHeadExit = (RoundedDouble) 2.1, SurfaceLine = surfaceLine, SoilProfile = soilProfile, HydraulicBoundaryLocation = hydraulicBoundaryLocation Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs =================================================================== diff -u -r252605cde31dfde56c723feb0cf14b8597d12430 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 252605cde31dfde56c723feb0cf14b8597d12430) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -1,7 +1,6 @@ using System; using System.ComponentModel; using System.Linq; - using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; @@ -50,7 +49,7 @@ { IsAquifer = true } - }); + }, 0); var testHydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(0.0); var inputParameters = new PipingInput(new GeneralPipingInput()) @@ -114,7 +113,7 @@ const double entryPointL = 0.12; // Call - properties.EntryPointL = (RoundedDouble)entryPointL; + properties.EntryPointL = (RoundedDouble) entryPointL; // Assert Assert.AreEqual(entryPointL, inputParameters.EntryPointL.Value); @@ -138,7 +137,7 @@ Random random = new Random(22); double assessmentLevel = random.NextDouble(); - + var dampingFactorExit = new LognormalDistribution(3); var phreaticLevelExit = new NormalDistribution(2); var thicknessCoverageLayer = new LognormalDistribution(2); @@ -213,11 +212,10 @@ Enumerable.Empty(), Enumerable.Empty(), assessmentSectionMock), - ExitPointL = (RoundedDouble)exitPoint, - EntryPointL = (RoundedDouble)entryPoint + ExitPointL = (RoundedDouble) exitPoint, + EntryPointL = (RoundedDouble) entryPoint }; - // Call & Assert Assert.AreEqual(seepageLength, properties.SeepageLength.Distribution.Mean, 1e-6); Assert.AreEqual(properties.ExitPointL, inputParameters.ExitPointL); @@ -248,11 +246,10 @@ Enumerable.Empty(), Enumerable.Empty(), assessmentSectionMock), - EntryPointL = (RoundedDouble)0.5, - ExitPointL = (RoundedDouble)2 + EntryPointL = (RoundedDouble) 0.5, + ExitPointL = (RoundedDouble) 2 }; - // Call & Assert Assert.AreEqual(1.5, properties.SeepageLength.Distribution.Mean.Value); Assert.AreEqual(properties.ExitPointL, inputParameters.ExitPointL); @@ -286,12 +283,12 @@ }; const double l = 2.0; - properties.ExitPointL = (RoundedDouble)l; + properties.ExitPointL = (RoundedDouble) l; inputParameters.Attach(inputObserver); // Call - properties.EntryPointL = (RoundedDouble)l; + properties.EntryPointL = (RoundedDouble) l; // Assert Assert.IsNaN(properties.SeepageLength.GetDesignValue()); @@ -322,12 +319,12 @@ }; const double l = 2.0; - properties.EntryPointL = (RoundedDouble)l; + properties.EntryPointL = (RoundedDouble) l; inputParameters.Attach(inputObserver); // Call - properties.ExitPointL = (RoundedDouble)l; + properties.ExitPointL = (RoundedDouble) l; // Assert Assert.IsNaN(properties.SeepageLength.GetDesignValue()); @@ -348,7 +345,7 @@ double assessmentLevel = new Random(21).NextDouble(); var inputParameters = new PipingInput(new GeneralPipingInput()) { - HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, String.Empty, 0.0,0.0) + HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, String.Empty, 0.0, 0.0) { DesignWaterLevel = assessmentLevel } @@ -432,7 +429,7 @@ Enumerable.Empty(), assessmentSectionMock) }; - inputParameters.PiezometricHeadExit = (RoundedDouble)double.NaN; + inputParameters.PiezometricHeadExit = (RoundedDouble) double.NaN; inputParameters.HydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, string.Empty, 0, 0) { DesignWaterLevel = 1.0 @@ -447,7 +444,7 @@ Assert.NotNull(properties); // When - properties[propertyIndexToChange].SetValue(phreaticLevelExitProperty, (RoundedDouble)2.3); + properties[propertyIndexToChange].SetValue(phreaticLevelExitProperty, (RoundedDouble) 2.3); // Then Assert.IsFalse(double.IsNaN(inputParameters.PiezometricHeadExit)); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingSoilProfilePropertiesTest.cs =================================================================== diff -u -r0c64d8a6c718c0aa67403a16c94dd0c10f862455 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingSoilProfilePropertiesTest.cs (.../PipingSoilProfilePropertiesTest.cs) (revision 0c64d8a6c718c0aa67403a16c94dd0c10f862455) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingSoilProfilePropertiesTest.cs (.../PipingSoilProfilePropertiesTest.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -1,8 +1,6 @@ using System.Collections.Generic; using System.Linq; -using Core.Common.Gui; using Core.Common.Gui.PropertyBag; - using NUnit.Framework; using Ringtoets.Piping.Data; using Ringtoets.Piping.Forms.PropertyClasses; @@ -28,22 +26,24 @@ { // Setup const string expectedName = ""; - IEnumerable layers = new [] + IEnumerable layers = new[] { - new PipingSoilLayer(-2), + new PipingSoilLayer(-2), new PipingSoilLayer(-4) { IsAquifer = true - } + } }; - var soilProfile = new PipingSoilProfile(expectedName, -5.0, layers); + var soilProfile = new PipingSoilProfile(expectedName, -5.0, layers, 0); + + // Call var properties = new PipingSoilProfileProperties { Data = soilProfile }; - // Call & Assert + // Assert Assert.AreEqual(expectedName, properties.Name); CollectionAssert.AreEqual(soilProfile.Layers.Select(l => l.Top), properties.TopLevels); Assert.AreEqual(soilProfile.Bottom, properties.Bottom); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingSoilProfileCollectionTreeNodeInfoTest.cs =================================================================== diff -u -rd8ca552454f8c1bf36269890b70f104c810fbf7f -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingSoilProfileCollectionTreeNodeInfoTest.cs (.../PipingSoilProfileCollectionTreeNodeInfoTest.cs) (revision d8ca552454f8c1bf36269890b70f104c810fbf7f) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingSoilProfileCollectionTreeNodeInfoTest.cs (.../PipingSoilProfileCollectionTreeNodeInfoTest.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -106,8 +106,8 @@ // Setup IEnumerable pipingSoilProfiles = new[] { - new PipingSoilProfile("", 0, new List { new PipingSoilLayer(10) }), - new PipingSoilProfile("", 0, new List { new PipingSoilLayer(10) }) + new PipingSoilProfile("", 0, new List { new PipingSoilLayer(10) }, 0), + new PipingSoilProfile("", 0, new List { new PipingSoilLayer(10) }, 0) }; // Call @@ -123,8 +123,8 @@ public void ChildNodeObjects_Always_ReturnsChildsOnData() { // Setup - var pipingSoilProfile1 = new PipingSoilProfile("", 0, new List { new PipingSoilLayer(10) }); - var pipingSoilProfile2 = new PipingSoilProfile("", 0, new List { new PipingSoilLayer(10) }); + var pipingSoilProfile1 = new PipingSoilProfile("", 0, new List { new PipingSoilLayer(10) }, 0); + var pipingSoilProfile2 = new PipingSoilProfile("", 0, new List { new PipingSoilLayer(10) }, 0); IEnumerable pipingSoilProfiles = new[] { pipingSoilProfile1, Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingSoilProfileTreeNodeInfoTest.cs =================================================================== diff -u -rd8ca552454f8c1bf36269890b70f104c810fbf7f -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingSoilProfileTreeNodeInfoTest.cs (.../PipingSoilProfileTreeNodeInfoTest.cs) (revision d8ca552454f8c1bf36269890b70f104c810fbf7f) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingSoilProfileTreeNodeInfoTest.cs (.../PipingSoilProfileTreeNodeInfoTest.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -53,7 +53,10 @@ // Setup var testName = "ttt"; var pipingSoilLayer = mocks.StrictMock(10); - var pipingSoilProfile = mocks.StrictMock(testName, 0, new[] { pipingSoilLayer }); + var pipingSoilProfile = mocks.StrictMock(testName, 0, new[] + { + pipingSoilLayer + }, 0); mocks.ReplayAll(); @@ -71,7 +74,10 @@ { // Setup var pipingSoilLayer = mocks.StrictMock(10); - var pipingSoilProfile = mocks.StrictMock("", 0, new[] { pipingSoilLayer }); + var pipingSoilProfile = mocks.StrictMock("", 0, new[] + { + pipingSoilLayer + }, 0); mocks.ReplayAll(); Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder1DTest.cs =================================================================== diff -u -rdc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder1DTest.cs (.../SoilProfileBuilder1DTest.cs) (revision dc2b06cb5a46cf2508d28fe9a6f8dcaa710346a7) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder1DTest.cs (.../SoilProfileBuilder1DTest.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -13,7 +13,7 @@ { // Setup var profileName = "SomeProfile"; - var builder = new SoilProfileBuilder1D(profileName, 0.0); + var builder = new SoilProfileBuilder1D(profileName, 0.0, 0); // Call TestDelegate test = () => builder.Build(); @@ -30,7 +30,8 @@ var random = new Random(22); var bottom = random.NextDouble(); var top = random.NextDouble(); - var builder = new SoilProfileBuilder1D(profileName, bottom); + const long pipingSoilProfileId = 1234L; + var builder = new SoilProfileBuilder1D(profileName, bottom, pipingSoilProfileId); builder.Add(new PipingSoilLayer(top) { IsAquifer = true @@ -42,6 +43,7 @@ // Assert Assert.AreEqual(profileName, soilProfile.Name); Assert.AreEqual(1, soilProfile.Layers.Count()); + Assert.AreEqual(pipingSoilProfileId, soilProfile.PipingSoilProfileId); Assert.AreEqual(top, soilProfile.Layers.ToArray()[0].Top); Assert.AreEqual(bottom, soilProfile.Bottom); } @@ -55,8 +57,9 @@ var bottom = random.NextDouble(); var top = bottom + random.NextDouble(); var top2 = bottom + random.NextDouble(); + const long pipingSoilProfileId = 1234L; - var builder = new SoilProfileBuilder1D(profileName, bottom); + var builder = new SoilProfileBuilder1D(profileName, bottom, pipingSoilProfileId); builder.Add(new PipingSoilLayer(top) { IsAquifer = true @@ -69,8 +72,13 @@ // Assert Assert.AreEqual(profileName, soilProfile.Name); Assert.AreEqual(2, soilProfile.Layers.Count()); - CollectionAssert.AreEquivalent(new [] {top,top2}, soilProfile.Layers.Select(l => l.Top)); + CollectionAssert.AreEquivalent(new[] + { + top, + top2 + }, soilProfile.Layers.Select(l => l.Top)); Assert.AreEqual(bottom, soilProfile.Bottom); + Assert.AreEqual(pipingSoilProfileId, soilProfile.PipingSoilProfileId); } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder2DTest.cs =================================================================== diff -u -r06f9145d8180df7fd26eac086a3f431c181e4d64 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder2DTest.cs (.../SoilProfileBuilder2DTest.cs) (revision 06f9145d8180df7fd26eac086a3f431c181e4d64) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilProfileBuilder2DTest.cs (.../SoilProfileBuilder2DTest.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -1,13 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; - using Core.Common.Base.Geometry; - using NUnit.Framework; - using Ringtoets.Piping.Data; - using Ringtoets.Piping.Data.TestUtil; using Ringtoets.Piping.IO.Builders; using Ringtoets.Piping.IO.Properties; @@ -22,7 +18,7 @@ public void Constructor_WithNameInvalidX_ThrowsArgumentException(string name) { // Call - TestDelegate test = () => new SoilProfileBuilder2D(name, double.NaN); + TestDelegate test = () => new SoilProfileBuilder2D(name, double.NaN, 0); // Assert var exception = Assert.Throws(test); @@ -36,7 +32,7 @@ public void Constructor_WithNameValidX_DoesNotThrow(string name) { // Call - TestDelegate test = () => new SoilProfileBuilder2D(name, 0.0); + TestDelegate test = () => new SoilProfileBuilder2D(name, 0.0, 0); // Assert Assert.DoesNotThrow(test); @@ -48,29 +44,28 @@ // Setup var profileName = "SomeProfile"; var atX = 0.0; - var builder = new SoilProfileBuilder2D(profileName, atX); + var builder = new SoilProfileBuilder2D(profileName, atX, 0); SoilLayer2D soilLayer = new SoilLayer2D { - OuterLoop = new List { + OuterLoop = new List + { new Segment2D - ( - new Point2D(atX,0.0), - new Point2D(atX,1.0) - ), + ( + new Point2D(atX, 0.0), + new Point2D(atX, 1.0) + ), new Segment2D( - - new Point2D(atX,1.0), - new Point2D(0.5,0.5) - ), + new Point2D(atX, 1.0), + new Point2D(0.5, 0.5) + ), new Segment2D( - - new Point2D(0.5,0.5), - new Point2D(atX,0.0) - ) + new Point2D(0.5, 0.5), + new Point2D(atX, 0.0) + ) } }; - + // Call TestDelegate test = () => builder.Add(soilLayer); @@ -86,7 +81,7 @@ { // Setup var profileName = "SomeProfile"; - var builder = new SoilProfileBuilder2D(profileName, 0.0); + var builder = new SoilProfileBuilder2D(profileName, 0.0, 0); // Call TestDelegate test = () => builder.Build(); @@ -100,7 +95,8 @@ { // Setup var profileName = "SomeProfile"; - var builder = new SoilProfileBuilder2D(profileName, 0.0); + const long pipingSoilProfileId = 1234L; + var builder = new SoilProfileBuilder2D(profileName, 0.0, pipingSoilProfileId); var firstPoint = new Point2D(-0.5, 1.0); var secondPoint = new Point2D(0.5, 1.0); var thirdPoint = new Point2D(0.5, -1.0); @@ -109,10 +105,10 @@ { OuterLoop = new List { - new Segment2D(firstPoint,secondPoint), - new Segment2D(secondPoint,thirdPoint), - new Segment2D(thirdPoint,fourthPoint), - new Segment2D(fourthPoint,firstPoint) + new Segment2D(firstPoint, secondPoint), + new Segment2D(secondPoint, thirdPoint), + new Segment2D(thirdPoint, fourthPoint), + new Segment2D(fourthPoint, firstPoint) }, IsAquifer = 1.0 }); @@ -125,59 +121,61 @@ Assert.AreEqual(1, soilProfile.Layers.Count()); Assert.AreEqual(1.0, soilProfile.Layers.ToArray()[0].Top); Assert.AreEqual(-1.0, soilProfile.Bottom); + Assert.AreEqual(pipingSoilProfileId, soilProfile.PipingSoilProfileId); } [Test] public void Build_WithMultipleLayersOnlyOuterLoop_ReturnsProfileWithBottomAndALayers() { // Setup var profileName = "SomeProfile"; - var builder = new SoilProfileBuilder2D(profileName, 1.0); + const long pipingSoilProfileId = 1234L; + var builder = new SoilProfileBuilder2D(profileName, 1.0, pipingSoilProfileId); builder.Add(new SoilLayer2D { OuterLoop = Segment2DLoopCollectionHelper.CreateFromString(String.Join(Environment.NewLine, - "10", - "...", - "...", - "...", - "...", - "...", - "...", - "...", - "1.2", - "4.3", - "..." - )) + "10", + "...", + "...", + "...", + "...", + "...", + "...", + "...", + "1.2", + "4.3", + "..." + )) }).Add(new SoilLayer2D { OuterLoop = Segment2DLoopCollectionHelper.CreateFromString(String.Join(Environment.NewLine, - "10", - "...", - "...", - "...", - "...", - "...", - "4.3", - "...", - "1.2", - "...", - "..." - )) + "10", + "...", + "...", + "...", + "...", + "...", + "4.3", + "...", + "1.2", + "...", + "..." + )) }).Add(new SoilLayer2D { OuterLoop = Segment2DLoopCollectionHelper.CreateFromString(String.Join(Environment.NewLine, - "10", - "...", - "1.2", - "...", - "...", - "...", - "4.3", - "...", - "...", - "...", - "..." - )), + "10", + "...", + "1.2", + "...", + "...", + "...", + "4.3", + "...", + "...", + "...", + "..." + )), IsAquifer = 1.0 }); @@ -187,35 +185,41 @@ // Assert Assert.AreEqual(profileName, soilProfile.Name); Assert.AreEqual(3, soilProfile.Layers.Count()); - CollectionAssert.AreEquivalent(new[] { 2.0, 4.0, 8.0 }, soilProfile.Layers.Select(rl => rl.Top)); + CollectionAssert.AreEquivalent(new[] + { + 2.0, + 4.0, + 8.0 + }, soilProfile.Layers.Select(rl => rl.Top)); Assert.AreEqual(1.0, soilProfile.Bottom); + Assert.AreEqual(pipingSoilProfileId, soilProfile.PipingSoilProfileId); } - [Test] public void Build_WithLayerFilledWithOtherLayer_ReturnsProfileWithBottomAndALayers() { // Setup var profileName = "SomeProfile"; - var builder = new SoilProfileBuilder2D(profileName, 2.0); + const long pipingSoilProfileId = 1234L; + var builder = new SoilProfileBuilder2D(profileName, 2.0, pipingSoilProfileId); var loopHole = Segment2DLoopCollectionHelper.CreateFromString(String.Join(Environment.NewLine, - "5", - ".....", - ".4.1.", - ".3.2.", - ".....", - "....." - )); + "5", + ".....", + ".4.1.", + ".3.2.", + ".....", + "....." + )); var soilLayer2D = new SoilLayer2D { OuterLoop = Segment2DLoopCollectionHelper.CreateFromString(String.Join(Environment.NewLine, - "5", - "2...3", - ".....", - ".....", - ".....", - "1...4" - )), + "5", + "2...3", + ".....", + ".....", + ".....", + "1...4" + )), IsAquifer = 1.0 }; soilLayer2D.AddInnerLoop(loopHole); @@ -230,8 +234,14 @@ // Assert Assert.AreEqual(profileName, soilProfile.Name); Assert.AreEqual(3, soilProfile.Layers.Count()); - CollectionAssert.AreEquivalent(new[] { 4.0, 3.0, 2.0 }, soilProfile.Layers.Select(rl => rl.Top)); + CollectionAssert.AreEquivalent(new[] + { + 4.0, + 3.0, + 2.0 + }, soilProfile.Layers.Select(rl => rl.Top)); Assert.AreEqual(0.0, soilProfile.Bottom); + Assert.AreEqual(pipingSoilProfileId, soilProfile.PipingSoilProfileId); } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj =================================================================== diff -u -r14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision 14db78eb3fc065c42f2d92c60d9d6b4b43dc9bd7) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -66,7 +66,7 @@ - + Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/CriticalProfilePropertiesTest.cs =================================================================== diff -u -r98fc85d8cecf9edae9fe7c1f2f47b60ecda5e187 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/CriticalProfilePropertiesTest.cs (.../CriticalProfilePropertiesTest.cs) (revision 98fc85d8cecf9edae9fe7c1f2f47b60ecda5e187) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/CriticalProfilePropertiesTest.cs (.../CriticalProfilePropertiesTest.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -27,9 +27,11 @@ var reader = mocks.StrictMock(); string profileName = "profile"; var layerCount = 1; + long soilProfileId = 1234; reader.Expect(r => r.Read(SoilProfileDatabaseColumns.ProfileName)).IgnoreArguments().Return(profileName); reader.Expect(r => r.Read(SoilProfileDatabaseColumns.LayerCount)).IgnoreArguments().Return(layerCount); + reader.Expect(r => r.Read(SoilProfileDatabaseColumns.SoilProfileId)).IgnoreArguments().Return(soilProfileId); mocks.ReplayAll(); @@ -39,6 +41,7 @@ // Assert Assert.AreEqual(profileName, properties.ProfileName); Assert.AreEqual(layerCount, properties.LayerCount); + Assert.AreEqual(soilProfileId, properties.ProfileId); mocks.VerifyAll(); } Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/DSoilDatabaseQueryBuilderTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/DSoilDatabaseQueryBuilderTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/DSoilDatabaseQueryBuilderTest.cs (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -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.SoilProfile; + +namespace Ringtoets.Piping.IO.Test.SoilProfile +{ + [TestFixture] + public class DSoilDatabaseQueryBuilderTest + { + [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 = DSoilDatabaseQueryBuilder.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 = DSoilDatabaseQueryBuilder.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 = DSoilDatabaseQueryBuilder.GetCheckVersionQuery(); + + // Assert + Assert.AreEqual(expectedQuery, query); + } + } +} \ No newline at end of file Fisheye: Tag fab2798bdc0feb4454b6384aefbe9db3f9a294fb refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/DSoilQueryBuilderTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs =================================================================== diff -u -r8b85f978c7bbe5c29a6ada6509f14d0462b8b9c3 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs (.../PipingCalculationServiceTest.cs) (revision 8b85f978c7bbe5c29a6ada6509f14d0462b8b9c3) +++ Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs (.../PipingCalculationServiceTest.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -1,14 +1,12 @@ using System; using System.Linq; - using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.TestUtil; using Deltares.WTIPiping; -using Ringtoets.Piping.Calculation.TestUtil; - using NUnit.Framework; using Ringtoets.Piping.Calculation; +using Ringtoets.Piping.Calculation.TestUtil; using Ringtoets.Piping.Calculation.TestUtil.SubCalculator; using Ringtoets.Piping.Data; using Ringtoets.Piping.Data.TestUtil; @@ -70,8 +68,8 @@ new PipingSoilLayer(soilProfileTop) { IsAquifer = true - } - }); + } + }, 0); // Call var result = PipingCalculationService.CalculateThicknessCoverageLayer(invalidPipingCalculation.InputParameters); @@ -101,7 +99,7 @@ { IsAquifer = false } - }); + }, 0); PipingInput input = new PipingInput(new GeneralPipingInput()) { @@ -232,7 +230,6 @@ [Test] public void CalculateThicknessCoverageLayer_CompleteInput_InputSetOnSubCalculator() { - // Setup PipingCalculation validPipingCalculation = PipingCalculationFactory.CreateCalculationWithValidInput(); PipingInput input = validPipingCalculation.InputParameters; @@ -243,7 +240,7 @@ PipingCalculationService.CalculateThicknessCoverageLayer(validPipingCalculation.InputParameters); // Assert - var testFactory = (TestPipingSubCalculatorFactory)PipingCalculationService.SubCalculatorFactory; + var testFactory = (TestPipingSubCalculatorFactory) PipingCalculationService.SubCalculatorFactory; var effectiveThicknessCalculator = testFactory.LastCreatedEffectiveThicknessCalculator; Assert.AreEqual(input.ExitPointL.Value, effectiveThicknessCalculator.ExitPointXCoordinate); @@ -258,7 +255,6 @@ [Test] public void CalculatePiezometricHeadAtExit_CompleteInput_InputSetOnSubCalculator() { - // Setup PipingCalculation validPipingCalculation = PipingCalculationFactory.CreateCalculationWithValidInput(); PipingInput input = validPipingCalculation.InputParameters; @@ -269,7 +265,7 @@ PipingCalculationService.CalculatePiezometricHeadAtExit(validPipingCalculation.InputParameters); // Assert - var testFactory = (TestPipingSubCalculatorFactory)PipingCalculationService.SubCalculatorFactory; + var testFactory = (TestPipingSubCalculatorFactory) PipingCalculationService.SubCalculatorFactory; var piezometricHeadAtExitCalculator = testFactory.LastCreatedPiezometricHeadAtExitCalculator; Assert.AreEqual(input.AssessmentLevel.Value, piezometricHeadAtExitCalculator.HRiver); @@ -286,7 +282,7 @@ var heaveCalculator = testFactory.LastCreatedHeaveCalculator; var upliftCalculator = testFactory.LastCreatedUpliftCalculator; var sellmeijerCalculator = testFactory.LastCreatedSellmeijerCalculator; - + Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetThicknessCoverageLayer(input).GetDesignValue(), heaveCalculator.DTotal, GetAccuracy(input.ThicknessCoverageLayer.Mean)); Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), heaveCalculator.HExit, @@ -308,8 +304,8 @@ Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetDampingFactorExit(input).GetDesignValue(), upliftCalculator.RExit, GetAccuracy(input.DampingFactorExit.Mean)); Assert.AreEqual(input.WaterVolumetricWeight, upliftCalculator.VolumetricWeightOfWater); - RoundedDouble effectiveStress = PipingSemiProbabilisticDesignValueFactory.GetThicknessCoverageLayer(input).GetDesignValue() * - (PipingSemiProbabilisticDesignValueFactory.GetSaturatedVolumicWeightOfCoverageLayer(input).GetDesignValue() - input.WaterVolumetricWeight); + RoundedDouble effectiveStress = PipingSemiProbabilisticDesignValueFactory.GetThicknessCoverageLayer(input).GetDesignValue()* + (PipingSemiProbabilisticDesignValueFactory.GetSaturatedVolumicWeightOfCoverageLayer(input).GetDesignValue() - input.WaterVolumetricWeight); Assert.AreEqual(effectiveStress, upliftCalculator.EffectiveStress, GetAccuracy(effectiveStress)); Index: Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingInputSynchronizerTest.cs =================================================================== diff -u -r8b85f978c7bbe5c29a6ada6509f14d0462b8b9c3 -rfab2798bdc0feb4454b6384aefbe9db3f9a294fb --- Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingInputSynchronizerTest.cs (.../PipingInputSynchronizerTest.cs) (revision 8b85f978c7bbe5c29a6ada6509f14d0462b8b9c3) +++ Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingInputSynchronizerTest.cs (.../PipingInputSynchronizerTest.cs) (revision fab2798bdc0feb4454b6384aefbe9db3f9a294fb) @@ -7,6 +7,7 @@ using Ringtoets.Piping.Calculation; using Ringtoets.Piping.Calculation.TestUtil.SubCalculator; using Ringtoets.Piping.Data; +using Ringtoets.Piping.Service.Properties; using Ringtoets.Piping.Service.TestUtil; namespace Ringtoets.Piping.Service.Test @@ -100,7 +101,7 @@ Assert.AreEqual(2, result.NumberOfDecimalPlaces); Assert.IsFalse(double.IsNaN(result)); - var factory = (TestPipingSubCalculatorFactory)PipingCalculationService.SubCalculatorFactory; + var factory = (TestPipingSubCalculatorFactory) PipingCalculationService.SubCalculatorFactory; var piezometricHeadAtExitCalculator = factory.LastCreatedPiezometricHeadAtExitCalculator; Assert.AreEqual(input.AssessmentLevel.Value, piezometricHeadAtExitCalculator.HRiver); @@ -208,8 +209,8 @@ // Assert var messages = new[] { - Properties.Resources.PipingInputSynchronizer_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer, - Properties.Resources.PipingInputSynchronizer_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer + Resources.PipingInputSynchronizer_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer, + Resources.PipingInputSynchronizer_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer }; TestHelper.AssertLogMessagesAreGenerated(call, messages, 2); Assert.IsNaN(input.ThicknessCoverageLayer.Mean); @@ -236,7 +237,7 @@ { // Setup var input = CreateInputWithAquiferAndCoverageLayer(); - input.ExitPointL = (RoundedDouble)double.NaN; + input.ExitPointL = (RoundedDouble) double.NaN; PipingInputSynchronizer.Synchronize(input); // Call @@ -252,7 +253,7 @@ { // Setup var input = CreateInputWithAquiferAndCoverageLayer(); - input.ExitPointL = (RoundedDouble)3.0; + input.ExitPointL = (RoundedDouble) 3.0; PipingInputSynchronizer.Synchronize(input); // Call @@ -261,8 +262,8 @@ // Assert var messages = new[] { - Properties.Resources.PipingInputSynchronizer_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer, - Properties.Resources.PipingInputSynchronizer_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer + Resources.PipingInputSynchronizer_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer, + Resources.PipingInputSynchronizer_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer }; TestHelper.AssertLogMessagesAreGenerated(call, messages, 2); Assert.IsNaN(input.ThicknessCoverageLayer.Mean); @@ -299,16 +300,16 @@ { IsAquifer = false } - }); + }, 0); // Call Action call = () => input.NotifyObservers(); // Assert var messages = new[] { - Properties.Resources.PipingInputSynchronizer_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer, - Properties.Resources.PipingInputSynchronizer_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer + Resources.PipingInputSynchronizer_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer, + Resources.PipingInputSynchronizer_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer }; TestHelper.AssertLogMessagesAreGenerated(call, messages, 2); Assert.IsNaN(input.ThicknessCoverageLayer.Mean); @@ -376,13 +377,13 @@ { IsAquifer = true } - }); + }, 0); // Call Action call = () => input.NotifyObservers(); // Assert - var message = Properties.Resources.PipingInputSynchronizer_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer; + var message = Resources.PipingInputSynchronizer_UpdateThicknessAquiferLayer_Cannot_determine_thickness_aquifer_layer; TestHelper.AssertLogMessageIsGenerated(call, message, 1); Assert.IsNaN(input.ThicknessAquiferLayer.Mean); } @@ -403,13 +404,13 @@ { IsAquifer = true } - }); + }, 0); // Call Action call = () => input.NotifyObservers(); // Assert - var message = Properties.Resources.PipingInputSynchronizer_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer; + var message = Resources.PipingInputSynchronizer_UpdateThicknessCoverageLayer_Cannot_determine_thickness_coverage_layer; TestHelper.AssertLogMessageIsGenerated(call, message, 1); Assert.IsNaN(input.ThicknessCoverageLayer.Mean); } @@ -430,7 +431,7 @@ { IsAquifer = true } - }); + }, 0); // Call input.NotifyObservers(); @@ -457,7 +458,7 @@ { IsAquifer = true } - }); + }, 0); return new PipingInput(new GeneralPipingInput()) { @@ -490,12 +491,12 @@ { IsAquifer = false } - }); + }, 0); var input = new PipingInput(new GeneralPipingInput()) { SurfaceLine = surfaceLine, SoilProfile = soilProfile, - ExitPointL = (RoundedDouble)0.5 + ExitPointL = (RoundedDouble) 0.5 }; return input; } @@ -522,12 +523,12 @@ { IsAquifer = true } - }); + }, 0); var input = new PipingInput(new GeneralPipingInput()) { SurfaceLine = surfaceLine, SoilProfile = soilProfile, - ExitPointL = (RoundedDouble)0.5 + ExitPointL = (RoundedDouble) 0.5 }; expectedThickness = 2.2; return input;