Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj
===================================================================
diff -u -r36d13a2d6fade97d565f186f5eaec5d382cba27a -r4afb3d635232a5570c867f890f2c8b4f973ea7f7
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 36d13a2d6fade97d565f186f5eaec5d382cba27a)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -409,9 +409,12 @@
-
+
+
+
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressEntityReadExtensions.cs (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -0,0 +1,56 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Application.Ringtoets.Storage.DbContext;
+using Ringtoets.MacroStabilityInwards.Primitives;
+
+namespace Application.Ringtoets.Storage.Read.MacroStabilityInwards
+{
+ ///
+ /// This class defines extension methods for read operations for a
+ /// based on the .
+ ///
+ internal static class MacroStabilityInwardsPreconsolidationStressEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information
+ /// to construct a .
+ ///
+ /// The to create
+ /// for.
+ /// A new .
+ /// Thrown when is null.
+ public static MacroStabilityInwardsPreconsolidationStress Read(this MacroStabilityInwardsPreconsolidationStressEntity entity)
+ {
+ if (entity == null)
+ {
+ throw new ArgumentNullException(nameof(entity));
+ }
+
+ return new MacroStabilityInwardsPreconsolidationStress(entity.CoordinateX,
+ entity.CoordinateZ,
+ entity.PreconsolidationStressMean,
+ entity.PreconsolidationStressCoefficientOfVariation
+ );
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 4afb3d635232a5570c867f890f2c8b4f973ea7f7 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityReadExtensions.cs (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -0,0 +1,84 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Drawing;
+using Application.Ringtoets.Storage.DbContext;
+using Core.Common.Base.Geometry;
+using Ringtoets.MacroStabilityInwards.Primitives;
+
+namespace Application.Ringtoets.Storage.Read.MacroStabilityInwards
+{
+ ///
+ /// This class defines extension methods for read operations for a
+ /// based on the .
+ ///
+ internal static class MacroStabilityInwardsSoilLayerTwoDEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information
+ /// to construct a .
+ ///
+ /// The to create
+ /// for.
+ /// A new .
+ /// Thrown when is null.
+ public static MacroStabilityInwardsSoilLayer2D Read(this MacroStabilityInwardsSoilLayerTwoDEntity entity)
+ {
+ if (entity == null)
+ {
+ throw new ArgumentNullException(nameof(entity));
+ }
+
+ return new MacroStabilityInwardsSoilLayer2D(new Ring(new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }), new Ring[0])
+ {
+ Properties =
+ {
+ IsAquifer = Convert.ToBoolean(entity.IsAquifer),
+ MaterialName = entity.MaterialName ?? string.Empty,
+ Color = Color.FromArgb(Convert.ToInt32(entity.Color)),
+ UsePop = Convert.ToBoolean(entity.UsePop),
+ ShearStrengthModel = (MacroStabilityInwardsShearStrengthModel) entity.ShearStrengthModel,
+ AbovePhreaticLevelMean = entity.AbovePhreaticLevelMean.ToNullAsNaN(),
+ AbovePhreaticLevelCoefficientOfVariation = entity.AbovePhreaticLevelCoefficientOfVariation.ToNullAsNaN(),
+ AbovePhreaticLevelShift = entity.AbovePhreaticLevelShift.ToNullAsNaN(),
+ BelowPhreaticLevelMean = entity.BelowPhreaticLevelMean.ToNullAsNaN(),
+ BelowPhreaticLevelCoefficientOfVariation = entity.BelowPhreaticLevelCoefficientOfVariation.ToNullAsNaN(),
+ BelowPhreaticLevelShift = entity.BelowPhreaticLevelShift.ToNullAsNaN(),
+ CohesionMean = entity.CohesionMean.ToNullAsNaN(),
+ CohesionCoefficientOfVariation = entity.CohesionCoefficientOfVariation.ToNullAsNaN(),
+ FrictionAngleMean = entity.FrictionAngleMean.ToNullAsNaN(),
+ FrictionAngleCoefficientOfVariation = entity.FrictionAngleCoefficientOfVariation.ToNullAsNaN(),
+ ShearStrengthRatioMean = entity.ShearStrengthRatioMean.ToNullAsNaN(),
+ ShearStrengthRatioCoefficientOfVariation = entity.ShearStrengthRatioCoefficientOfVariation.ToNullAsNaN(),
+ StrengthIncreaseExponentMean = entity.StrengthIncreaseExponentMean.ToNullAsNaN(),
+ StrengthIncreaseExponentCoefficientOfVariation = entity.StrengthIncreaseExponentCoefficientOfVariation.ToNullAsNaN(),
+ PopMean = entity.PopMean.ToNullAsNaN(),
+ PopCoefficientOfVariation = entity.PopCoefficientOfVariation.ToNullAsNaN()
+ }
+ };
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSoilProfileTwoDEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSoilProfileTwoDEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSoilProfileTwoDEntityReadExtensions.cs (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -0,0 +1,76 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Application.Ringtoets.Storage.DbContext;
+using Ringtoets.MacroStabilityInwards.Primitives;
+
+namespace Application.Ringtoets.Storage.Read.MacroStabilityInwards
+{
+ ///
+ /// This class defines extension methods for read operations for a
+ /// based on the .
+ ///
+ internal static class MacroStabilityInwardsSoilProfileTwoDEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information
+ /// to construct a .
+ ///
+ /// The to
+ /// create for.
+ /// The object keeping track of read operations.
+ /// A new or one from the
+ /// if the has been read before.
+ /// Thrown when any input parameter is null.
+ public static MacroStabilityInwardsSoilProfile2D Read(this MacroStabilityInwardsSoilProfileTwoDEntity entity,
+ ReadConversionCollector collector)
+ {
+ if (entity == null)
+ {
+ throw new ArgumentNullException(nameof(entity));
+ }
+ if (collector == null)
+ {
+ throw new ArgumentNullException(nameof(collector));
+ }
+
+ if (collector.Contains(entity))
+ {
+ return collector.Get(entity);
+ }
+ IEnumerable layers = entity.MacroStabilityInwardsSoilLayerTwoDEntities.OrderBy(sl => sl.Order)
+ .Select(sl => sl.Read())
+ .ToArray();
+ IEnumerable preconsolidationStresses = entity.MacroStabilityInwardsPreconsolidationStressEntities
+ .Select(e => e.Read())
+ .ToArray();
+ var soilProfile = new MacroStabilityInwardsSoilProfile2D(entity.Name,
+ layers,
+ preconsolidationStresses);
+
+ collector.Read(entity, soilProfile);
+ return soilProfile;
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityReadExtensions.cs (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -0,0 +1,88 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Application.Ringtoets.Storage.DbContext;
+using Ringtoets.MacroStabilityInwards.Data.SoilProfile;
+using Ringtoets.MacroStabilityInwards.Primitives;
+
+namespace Application.Ringtoets.Storage.Read.MacroStabilityInwards
+{
+ ///
+ /// This class defines extension methods for read operations for a
+ /// based on the .
+ ///
+ internal static class MacroStabilityInwardsStochasticSoilProfileEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information to
+ /// construct a .
+ ///
+ /// The to create
+ /// for.
+ /// The object keeping track of read operations.
+ /// A new .
+ /// Thrown when any input parameter is null.
+ public static MacroStabilityInwardsStochasticSoilProfile Read(this MacroStabilityInwardsStochasticSoilProfileEntity entity,
+ ReadConversionCollector collector)
+ {
+ if (entity == null)
+ {
+ throw new ArgumentNullException(nameof(entity));
+ }
+ if (collector == null)
+ {
+ throw new ArgumentNullException(nameof(collector));
+ }
+
+ if (collector.Contains(entity))
+ {
+ return collector.Get(entity);
+ }
+
+ var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(entity.Probability, entity.ReadSoilProfile(collector));
+
+ collector.Read(entity, stochasticSoilProfile);
+
+ return stochasticSoilProfile;
+ }
+
+ private static IMacroStabilityInwardsSoilProfile ReadSoilProfile(this MacroStabilityInwardsStochasticSoilProfileEntity entity,
+ ReadConversionCollector collector)
+ {
+ return entity.MacroStabilityInwardsSoilProfileOneDEntity != null
+ ? ReadSoilProfile1D(entity, collector)
+ : ReadSoilProfile2D(entity, collector);
+ }
+
+ private static IMacroStabilityInwardsSoilProfile ReadSoilProfile1D(this MacroStabilityInwardsStochasticSoilProfileEntity entity,
+ ReadConversionCollector collector)
+ {
+ return entity.MacroStabilityInwardsSoilProfileOneDEntity.Read(collector);
+ }
+
+ private static IMacroStabilityInwardsSoilProfile ReadSoilProfile2D(this MacroStabilityInwardsStochasticSoilProfileEntity entity,
+ ReadConversionCollector collector)
+ {
+ return entity.MacroStabilityInwardsSoilProfileTwoDEntity.Read(collector);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingStochasticSoilProfileEntityReadExtensions.cs
===================================================================
diff -u -ra096cb901099c85dbaafa2dba6c69288464c248e -r4afb3d635232a5570c867f890f2c8b4f973ea7f7
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingStochasticSoilProfileEntityReadExtensions.cs (.../PipingStochasticSoilProfileEntityReadExtensions.cs) (revision a096cb901099c85dbaafa2dba6c69288464c248e)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingStochasticSoilProfileEntityReadExtensions.cs (.../PipingStochasticSoilProfileEntityReadExtensions.cs) (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -40,14 +40,19 @@
/// for.
/// The object keeping track of read operations.
/// A new .
- /// Thrown when is null.
+ /// Thrown when any input parameter is null.
internal static PipingStochasticSoilProfile Read(this PipingStochasticSoilProfileEntity entity,
ReadConversionCollector collector)
{
+ if (entity == null)
+ {
+ throw new ArgumentNullException(nameof(entity));
+ }
if (collector == null)
{
throw new ArgumentNullException(nameof(collector));
}
+
if (collector.Contains(entity))
{
return collector.Get(entity);
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ReadConversionCollector.cs
===================================================================
diff -u -r8e213638a22dd9f04d965d875bb58156db019be5 -r4afb3d635232a5570c867f890f2c8b4f973ea7f7
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ReadConversionCollector.cs (.../ReadConversionCollector.cs) (revision 8e213638a22dd9f04d965d875bb58156db019be5)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ReadConversionCollector.cs (.../ReadConversionCollector.cs) (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -31,6 +31,7 @@
using Ringtoets.DuneErosion.Data;
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.HeightStructures.Data;
+using Ringtoets.MacroStabilityInwards.Data.SoilProfile;
using Ringtoets.MacroStabilityInwards.Primitives;
using Ringtoets.Piping.Data.SoilProfile;
using Ringtoets.Piping.Primitives;
@@ -56,6 +57,9 @@
private readonly Dictionary surfaceLines =
CreateDictionary();
+ private readonly Dictionary macroStabilityInwardsStochasticSoilProfiles =
+ CreateDictionary();
+
private readonly Dictionary macroStabilityInwardsSoil1DProfiles =
CreateDictionary();
@@ -376,6 +380,74 @@
#endregion
+ #region MacroStabilityInwardsStochasticSoilProfileEntity: Read, Contains, Get
+
+ ///
+ /// Registers a read operation for and
+ /// the that was constructed with the information.
+ ///
+ /// The that was read.
+ /// The that was constructed.
+ /// Thrown when any of the input parameters is null.
+ internal void Read(MacroStabilityInwardsStochasticSoilProfileEntity entity, MacroStabilityInwardsStochasticSoilProfile model)
+ {
+ if (entity == null)
+ {
+ throw new ArgumentNullException(nameof(entity));
+ }
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+
+ macroStabilityInwardsStochasticSoilProfiles[entity] = model;
+ }
+
+ ///
+ /// Checks whether a read operations has been registered for the given .
+ ///
+ /// The to check for.
+ /// true if the was read before, false otherwise.
+ /// Thrown when is null.
+ internal bool Contains(MacroStabilityInwardsStochasticSoilProfileEntity entity)
+ {
+ if (entity == null)
+ {
+ throw new ArgumentNullException(nameof(entity));
+ }
+ return macroStabilityInwardsStochasticSoilProfiles.ContainsKey(entity);
+ }
+
+ ///
+ /// Obtains the which was read for the given
+ /// .
+ ///
+ /// The for which
+ /// a read operation has been registered.
+ /// The constructed .
+ /// Thrown when is null.
+ /// Thrown when no read operation has been
+ /// registered for .
+ /// Use to find out
+ /// whether a read operation has been registered for .
+ internal MacroStabilityInwardsStochasticSoilProfile Get(MacroStabilityInwardsStochasticSoilProfileEntity entity)
+ {
+ if (entity == null)
+ {
+ throw new ArgumentNullException(nameof(entity));
+ }
+ try
+ {
+ return macroStabilityInwardsStochasticSoilProfiles[entity];
+ }
+ catch (KeyNotFoundException e)
+ {
+ throw new InvalidOperationException(e.Message, e);
+ }
+ }
+
+ #endregion
+
#region MacroStabilityInwardsSoilProfileOneDEntity: Read, Contains, Get
///
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj
===================================================================
diff -u -r36d13a2d6fade97d565f186f5eaec5d382cba27a -r4afb3d635232a5570c867f890f2c8b4f973ea7f7
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 36d13a2d6fade97d565f186f5eaec5d382cba27a)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -147,9 +147,12 @@
-
+
+
+
+
@@ -397,10 +400,6 @@
{955E574D-67CE-4347-AA6B-7DF8A04ED754}
Ringtoets.Piping.Data.TestUtil
-
- {27E0A5C9-3ABF-426A-A3DA-7D0B83A218C8}
- Ringtoets.Piping.KernelWrapper.TestUtil
-
{b479e3af-7c34-488c-bb73-d324100d36c9}
Ringtoets.StabilityStoneCover.Data
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile2DCreateExtensionsTest.cs
===================================================================
diff -u -rd5d457c61d546522500542ac8fe3967882e0157e -r4afb3d635232a5570c867f890f2c8b4f973ea7f7
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile2DCreateExtensionsTest.cs (.../MacroStabilityInwardsSoilProfile2DCreateExtensionsTest.cs) (revision d5d457c61d546522500542ac8fe3967882e0157e)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile2DCreateExtensionsTest.cs (.../MacroStabilityInwardsSoilProfile2DCreateExtensionsTest.cs) (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -97,6 +97,9 @@
Assert.IsNotNull(entity);
Assert.AreEqual(2, entity.MacroStabilityInwardsSoilLayerTwoDEntities.Count);
Assert.AreEqual(1, entity.MacroStabilityInwardsPreconsolidationStressEntities.Count);
+
+ AssertPreconsolidationStress(soilProfile.PreconsolidationStresses.First(),
+ entity.MacroStabilityInwardsPreconsolidationStressEntities.First());
}
[Test]
@@ -130,6 +133,15 @@
Assert.AreSame(firstEntity, secondEntity);
}
+ private static void AssertPreconsolidationStress(MacroStabilityInwardsPreconsolidationStress preconsolidationStress,
+ MacroStabilityInwardsPreconsolidationStressEntity entity)
+ {
+ Assert.AreEqual(preconsolidationStress.XCoordinate, entity.CoordinateX);
+ Assert.AreEqual(preconsolidationStress.ZCoordinate, entity.CoordinateZ);
+ Assert.AreEqual(preconsolidationStress.PreconsolidationStressMean, entity.PreconsolidationStressMean);
+ Assert.AreEqual(preconsolidationStress.PreconsolidationStressCoefficientOfVariation, entity.PreconsolidationStressCoefficientOfVariation);
+ }
+
private static MacroStabilityInwardsSoilProfile2D CreateMacroStabilityInwardsSoilProfile2D()
{
return CreateMacroStabilityInwardsSoilProfile2D(string.Empty);
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressEntityReadExtensionsTest.cs (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -0,0 +1,68 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read.MacroStabilityInwards;
+using NUnit.Framework;
+using Ringtoets.MacroStabilityInwards.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Read.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsPreconsolidationStressEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_EntityNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => ((MacroStabilityInwardsPreconsolidationStressEntity) null).Read();
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("entity", exception.ParamName);
+ }
+
+ [Test]
+ public void Read_WithValues_ReturnsExpectedMacroStabilityInwardsPreconsolidationStress()
+ {
+ // Setup
+ var random = new Random(31);
+ var entity = new MacroStabilityInwardsPreconsolidationStressEntity
+ {
+ CoordinateX = random.NextDouble(),
+ CoordinateZ = random.NextDouble(),
+ PreconsolidationStressMean = random.NextDouble(),
+ PreconsolidationStressCoefficientOfVariation = random.NextDouble()
+ };
+
+ // Call
+ MacroStabilityInwardsPreconsolidationStress stress = entity.Read();
+
+ // Assert
+ Assert.IsNotNull(stress);
+ Assert.AreEqual(entity.CoordinateX, stress.XCoordinate);
+ Assert.AreEqual(entity.CoordinateZ, stress.ZCoordinate);
+ Assert.AreEqual(entity.PreconsolidationStressMean, stress.PreconsolidationStressMean);
+ Assert.AreEqual(entity.PreconsolidationStressCoefficientOfVariation, stress.PreconsolidationStressCoefficientOfVariation);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 4afb3d635232a5570c867f890f2c8b4f973ea7f7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityReadExtensionsTest.cs (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -0,0 +1,174 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Drawing;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read.MacroStabilityInwards;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.MacroStabilityInwards.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Read.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsSoilLayerTwoDEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_EntityNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => ((MacroStabilityInwardsSoilLayerTwoDEntity) null).Read();
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("entity", exception.ParamName);
+ }
+
+ [Test]
+ public void Read_WithValues_ReturnsMacroStabilityInwardsSoilLayer2DWithDoubleParameterValues()
+ {
+ // Setup
+ var random = new Random(31);
+ int color = Color.FromKnownColor(random.NextEnumValue()).ToArgb();
+ bool isAquifer = random.NextBoolean();
+ double belowPhreaticLevelMean = random.NextDouble();
+ double belowPhreaticLevelCoefficientOfVariation = random.NextDouble();
+ double belowPhreaticLevelShift = random.NextDouble();
+ double abovePhreaticLevelMean = random.NextDouble();
+ double abovePhreaticLevelCoefficientOfVariation = random.NextDouble();
+ double abovePhreaticLevelShift = random.NextDouble();
+ double cohesionMean = random.NextDouble();
+ double cohesionCoefficientOfVariation = random.NextDouble();
+ double frictionAngleMean = random.NextDouble();
+ double frictionAngleCoefficientOfVariation = random.NextDouble();
+ double shearStrengthRatioMean = random.NextDouble();
+ double shearStrengthRatioCoefficientOfVariation = random.NextDouble();
+ double strengthIncreaseExponentMean = random.NextDouble();
+ double strengthIncreaseExponentCoefficientOfVariation = random.NextDouble();
+ double popMean = random.NextDouble();
+ double popCoefficientOfVariation = random.NextDouble();
+
+ var entity = new MacroStabilityInwardsSoilLayerTwoDEntity
+ {
+ IsAquifer = Convert.ToByte(isAquifer),
+ Color = color,
+ MaterialName = random.Next().ToString(),
+ AbovePhreaticLevelMean = abovePhreaticLevelMean,
+ AbovePhreaticLevelCoefficientOfVariation = abovePhreaticLevelCoefficientOfVariation,
+ AbovePhreaticLevelShift = abovePhreaticLevelShift,
+
+ BelowPhreaticLevelMean = belowPhreaticLevelMean,
+ BelowPhreaticLevelCoefficientOfVariation = belowPhreaticLevelCoefficientOfVariation,
+ BelowPhreaticLevelShift = belowPhreaticLevelShift,
+
+ CohesionMean = cohesionMean,
+ CohesionCoefficientOfVariation = cohesionCoefficientOfVariation,
+
+ FrictionAngleMean = frictionAngleMean,
+ FrictionAngleCoefficientOfVariation = frictionAngleCoefficientOfVariation,
+
+ ShearStrengthRatioMean = shearStrengthRatioMean,
+ ShearStrengthRatioCoefficientOfVariation = shearStrengthRatioCoefficientOfVariation,
+
+ StrengthIncreaseExponentMean = strengthIncreaseExponentMean,
+ StrengthIncreaseExponentCoefficientOfVariation = strengthIncreaseExponentCoefficientOfVariation,
+
+ PopMean = popMean,
+ PopCoefficientOfVariation = popCoefficientOfVariation
+ };
+
+ // Call
+ MacroStabilityInwardsSoilLayer2D layer = entity.Read();
+
+ // Assert
+ Assert.IsNotNull(layer);
+ MacroStabilityInwardsSoilLayerProperties properties = layer.Properties;
+ Assert.AreEqual(isAquifer, properties.IsAquifer);
+ Assert.AreEqual(Color.FromArgb(color), properties.Color);
+ Assert.AreEqual(entity.MaterialName, properties.MaterialName);
+
+ Assert.AreEqual(belowPhreaticLevelMean, properties.BelowPhreaticLevelMean);
+ Assert.AreEqual(belowPhreaticLevelCoefficientOfVariation, properties.BelowPhreaticLevelCoefficientOfVariation);
+ Assert.AreEqual(belowPhreaticLevelShift, properties.BelowPhreaticLevelShift);
+
+ Assert.AreEqual(abovePhreaticLevelMean, properties.AbovePhreaticLevelMean);
+ Assert.AreEqual(abovePhreaticLevelCoefficientOfVariation, properties.AbovePhreaticLevelCoefficientOfVariation);
+ Assert.AreEqual(abovePhreaticLevelShift, properties.AbovePhreaticLevelShift);
+
+ Assert.AreEqual(cohesionMean, properties.CohesionMean);
+ Assert.AreEqual(cohesionCoefficientOfVariation, properties.CohesionCoefficientOfVariation);
+
+ Assert.AreEqual(frictionAngleMean, properties.FrictionAngleMean);
+ Assert.AreEqual(frictionAngleCoefficientOfVariation, properties.FrictionAngleCoefficientOfVariation);
+
+ Assert.AreEqual(shearStrengthRatioMean, properties.ShearStrengthRatioMean);
+ Assert.AreEqual(shearStrengthRatioCoefficientOfVariation, properties.ShearStrengthRatioCoefficientOfVariation);
+
+ Assert.AreEqual(strengthIncreaseExponentMean, properties.StrengthIncreaseExponentMean);
+ Assert.AreEqual(strengthIncreaseExponentCoefficientOfVariation, properties.StrengthIncreaseExponentCoefficientOfVariation);
+
+ Assert.AreEqual(popMean, properties.PopMean);
+ Assert.AreEqual(popCoefficientOfVariation, properties.PopCoefficientOfVariation);
+ }
+
+ [Test]
+ public void Read_WithNullValues_ReturnsMacroStabilityInwardsSoilLayer2DWithNaNValues()
+ {
+ // Setup
+ var entity = new MacroStabilityInwardsSoilLayerTwoDEntity
+ {
+ MaterialName = nameof(MacroStabilityInwardsSoilLayerTwoDEntity)
+ };
+
+ // Call
+ MacroStabilityInwardsSoilLayer2D layer = entity.Read();
+
+ // Assert
+ Assert.IsNotNull(layer);
+ MacroStabilityInwardsSoilLayerProperties properties = layer.Properties;
+ Assert.AreEqual(entity.MaterialName, properties.MaterialName);
+
+ Assert.IsNaN(properties.AbovePhreaticLevelMean);
+ Assert.IsNaN(properties.AbovePhreaticLevelCoefficientOfVariation);
+ Assert.IsNaN(properties.AbovePhreaticLevelShift);
+
+ Assert.IsNaN(properties.BelowPhreaticLevelMean);
+ Assert.IsNaN(properties.BelowPhreaticLevelCoefficientOfVariation);
+ Assert.IsNaN(properties.BelowPhreaticLevelShift);
+
+ Assert.IsNaN(properties.CohesionMean);
+ Assert.IsNaN(properties.CohesionCoefficientOfVariation);
+
+ Assert.IsNaN(properties.FrictionAngleMean);
+ Assert.IsNaN(properties.FrictionAngleCoefficientOfVariation);
+
+ Assert.IsNaN(properties.ShearStrengthRatioMean);
+ Assert.IsNaN(properties.ShearStrengthRatioCoefficientOfVariation);
+
+ Assert.IsNaN(properties.StrengthIncreaseExponentMean);
+ Assert.IsNaN(properties.StrengthIncreaseExponentCoefficientOfVariation);
+
+ Assert.IsNaN(properties.PopMean);
+ Assert.IsNaN(properties.PopCoefficientOfVariation);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilProfileTwoDEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilProfileTwoDEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilProfileTwoDEntityReadExtensionsTest.cs (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -0,0 +1,170 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read;
+using Application.Ringtoets.Storage.Read.MacroStabilityInwards;
+using NUnit.Framework;
+using Ringtoets.MacroStabilityInwards.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Read.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsSoilProfileTwoDEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_CollectorNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var entity = new MacroStabilityInwardsSoilProfileTwoDEntity();
+
+ // Call
+ TestDelegate test = () => entity.Read(null);
+
+ // Assert
+ string parameter = Assert.Throws(test).ParamName;
+ Assert.AreEqual("collector", parameter);
+ }
+
+ [Test]
+ public void Read_EntityNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+
+ // Call
+ TestDelegate test = () => ((MacroStabilityInwardsSoilProfileTwoDEntity) null).Read(collector);
+
+ // Assert
+ string parameter = Assert.Throws(test).ParamName;
+ Assert.AreEqual("entity", parameter);
+ }
+
+ [Test]
+ public void Read_WithCollector_ReturnsSoilProfileWithPropertiesSet()
+ {
+ // Setup
+ var entity = new MacroStabilityInwardsSoilProfileTwoDEntity
+ {
+ Name = nameof(MacroStabilityInwardsSoilProfileTwoDEntity),
+ MacroStabilityInwardsSoilLayerTwoDEntities =
+ {
+ new MacroStabilityInwardsSoilLayerTwoDEntity
+ {
+ MaterialName = "A",
+ Order = 1
+ },
+ new MacroStabilityInwardsSoilLayerTwoDEntity
+ {
+ MaterialName = "B",
+ Order = 0
+ }
+ }
+ };
+ var collector = new ReadConversionCollector();
+
+ // Call
+ MacroStabilityInwardsSoilProfile2D profile = entity.Read(collector);
+
+ // Assert
+ Assert.IsNotNull(profile);
+ Assert.AreEqual(entity.Name, profile.Name);
+ CollectionAssert.AreEqual(new[]
+ {
+ "B",
+ "A"
+ }, profile.Layers.Select(l => l.Properties.MaterialName));
+ }
+
+ [Test]
+ public void Read_WithNullValues_ReturnsSoilProfileWithNaNValues()
+ {
+ // Setup
+ var entity = new MacroStabilityInwardsSoilProfileTwoDEntity
+ {
+ Name = nameof(MacroStabilityInwardsSoilProfileTwoDEntity),
+ MacroStabilityInwardsSoilLayerTwoDEntities =
+ {
+ new MacroStabilityInwardsSoilLayerTwoDEntity
+ {
+ MaterialName = nameof(MacroStabilityInwardsSoilLayerTwoDEntity)
+ }
+ }
+ };
+ var collector = new ReadConversionCollector();
+
+ // Call
+ MacroStabilityInwardsSoilProfile2D profile = entity.Read(collector);
+
+ // Assert
+ Assert.IsNotNull(profile);
+ Assert.AreEqual(entity.Name, profile.Name);
+ Assert.AreEqual(1, profile.Layers.Count());
+
+ MacroStabilityInwardsSoilLayer2D layer = profile.Layers.ElementAt(0);
+ Assert.AreEqual(entity.MacroStabilityInwardsSoilLayerTwoDEntities.First().MaterialName, layer.Properties.MaterialName);
+ }
+
+ [Test]
+ public void Read_WithCollectorWithoutLayers_ThrowsArgumentException()
+ {
+ // Setup
+ var entity = new MacroStabilityInwardsSoilProfileTwoDEntity
+ {
+ Name = "Name"
+ };
+ var collector = new ReadConversionCollector();
+
+ // Call
+ TestDelegate test = () => entity.Read(collector);
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void Read_WithCollectorReadTwice_ReturnsSameSoilProfile()
+ {
+ // Setup
+ const string testName = "testName";
+ var entity = new MacroStabilityInwardsSoilProfileTwoDEntity
+ {
+ Name = testName,
+ MacroStabilityInwardsSoilLayerTwoDEntities =
+ {
+ new MacroStabilityInwardsSoilLayerTwoDEntity(),
+ new MacroStabilityInwardsSoilLayerTwoDEntity()
+ }
+ };
+ var collector = new ReadConversionCollector();
+
+ MacroStabilityInwardsSoilProfile2D profile = entity.Read(collector);
+
+ // Call
+ MacroStabilityInwardsSoilProfile2D secondProfile = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(profile, secondProfile);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityReadExtensionsTest.cs (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -0,0 +1,151 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read;
+using Application.Ringtoets.Storage.Read.MacroStabilityInwards;
+using NUnit.Framework;
+using Ringtoets.MacroStabilityInwards.Data.SoilProfile;
+using Ringtoets.MacroStabilityInwards.Primitives;
+
+namespace Application.Ringtoets.Storage.Test.Read.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsStochasticSoilProfileEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_CollectorNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var entity = new MacroStabilityInwardsStochasticSoilProfileEntity();
+
+ // Call
+ TestDelegate test = () => entity.Read(null);
+
+ // Assert
+ string parameter = Assert.Throws(test).ParamName;
+ Assert.AreEqual("collector", parameter);
+ }
+
+ [Test]
+ public void Read_EntityNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+
+ // Call
+ TestDelegate test = () => ((MacroStabilityInwardsStochasticSoilProfileEntity) null).Read(collector);
+
+ // Assert
+ string parameter = Assert.Throws(test).ParamName;
+ Assert.AreEqual("entity", parameter);
+ }
+
+ [Test]
+ public void Read_WithCollectorAnd1dProfile_ReturnsStochasticSoilProfileWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(21);
+ var entity = new MacroStabilityInwardsStochasticSoilProfileEntity
+ {
+ Probability = random.NextDouble(),
+ MacroStabilityInwardsSoilProfileOneDEntity = new MacroStabilityInwardsSoilProfileOneDEntity
+ {
+ Name = "SoilProfile",
+ MacroStabilityInwardsSoilLayerOneDEntities =
+ {
+ new MacroStabilityInwardsSoilLayerOneDEntity()
+ }
+ }
+ };
+ var collector = new ReadConversionCollector();
+
+ // Call
+ MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile = entity.Read(collector);
+
+ // Assert
+ Assert.IsNotNull(stochasticSoilProfile);
+ Assert.AreEqual(entity.Probability, stochasticSoilProfile.Probability, 1e-6);
+
+ IMacroStabilityInwardsSoilProfile profile = stochasticSoilProfile.SoilProfile;
+ Assert.IsInstanceOf(profile);
+ Assert.AreEqual(entity.MacroStabilityInwardsSoilProfileOneDEntity.Name, profile.Name);
+ }
+
+ [Test]
+ public void Read_WithCollectorAnd2dProfile_ReturnsStochasticSoilProfileWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(21);
+ var entity = new MacroStabilityInwardsStochasticSoilProfileEntity
+ {
+ Probability = random.NextDouble(),
+ MacroStabilityInwardsSoilProfileTwoDEntity = new MacroStabilityInwardsSoilProfileTwoDEntity
+ {
+ Name = "SoilProfile",
+ MacroStabilityInwardsSoilLayerTwoDEntities =
+ {
+ new MacroStabilityInwardsSoilLayerTwoDEntity()
+ }
+ }
+ };
+ var collector = new ReadConversionCollector();
+
+ // Call
+ MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile = entity.Read(collector);
+
+ // Assert
+ Assert.IsNotNull(stochasticSoilProfile);
+ Assert.AreEqual(entity.Probability, stochasticSoilProfile.Probability, 1e-6);
+
+ IMacroStabilityInwardsSoilProfile profile = stochasticSoilProfile.SoilProfile;
+ Assert.IsInstanceOf(profile);
+ Assert.AreEqual(entity.MacroStabilityInwardsSoilProfileTwoDEntity.Name, profile.Name);
+ }
+
+ [Test]
+ public void Create_ForTheSameEntityTwice_ReturnsSameObjectInstance()
+ {
+ // Setup
+ var entity = new MacroStabilityInwardsStochasticSoilProfileEntity
+ {
+ MacroStabilityInwardsSoilProfileOneDEntity = new MacroStabilityInwardsSoilProfileOneDEntity
+ {
+ Name = "StochasticSoilProfile",
+ MacroStabilityInwardsSoilLayerOneDEntities =
+ {
+ new MacroStabilityInwardsSoilLayerOneDEntity()
+ }
+ }
+ };
+
+ var collector = new ReadConversionCollector();
+
+ // Call
+ MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile1 = entity.Read(collector);
+ MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile2 = entity.Read(collector);
+
+ // Assert
+ Assert.AreSame(stochasticSoilProfile1, stochasticSoilProfile2);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingStochasticSoilProfileEntityReadExtensionsTest.cs
===================================================================
diff -u -ra096cb901099c85dbaafa2dba6c69288464c248e -r4afb3d635232a5570c867f890f2c8b4f973ea7f7
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingStochasticSoilProfileEntityReadExtensionsTest.cs (.../PipingStochasticSoilProfileEntityReadExtensionsTest.cs) (revision a096cb901099c85dbaafa2dba6c69288464c248e)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingStochasticSoilProfileEntityReadExtensionsTest.cs (.../PipingStochasticSoilProfileEntityReadExtensionsTest.cs) (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -34,7 +34,7 @@
public class PipingStochasticSoilProfileEntityReadExtensionsTest
{
[Test]
- public void Read_WithoutCollector_ThrowsArgumentNullException()
+ public void Read_CollectorNull_ThrowsArgumentNullException()
{
// Setup
var entity = new PipingStochasticSoilProfileEntity();
@@ -48,14 +48,27 @@
}
[Test]
+ public void Read_EntityNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+
+ // Call
+ TestDelegate test = () => ((PipingStochasticSoilProfileEntity) null).Read(collector);
+
+ // Assert
+ string parameter = Assert.Throws(test).ParamName;
+ Assert.AreEqual("entity", parameter);
+ }
+
+ [Test]
public void Read_WithCollector_ReturnsNewStochasticSoilProfileWithPropertiesSetAndEntityRegistered()
{
// Setup
var random = new Random(21);
- double probability = random.NextDouble();
var entity = new PipingStochasticSoilProfileEntity
{
- Probability = probability,
+ Probability = random.NextDouble(),
PipingSoilProfileEntity = new PipingSoilProfileEntity
{
Name = "StochasticSoilProfile",
@@ -73,12 +86,12 @@
// Assert
Assert.IsNotNull(profile);
- Assert.AreEqual(probability, profile.Probability, 1e-6);
+ Assert.AreEqual(entity.Probability, profile.Probability, 1e-6);
Assert.IsTrue(collector.Contains(entity));
}
[Test]
- public void Read_WithCollectorDifferentStochasticSoilProfileEntitiesWithSameSoilProfileEntity_ReturnsStochasticSoilProfilesWithSamePipingSoilProfile()
+ public void Read_DifferentStochasticSoilProfileEntitiesWithSameSoilProfileEntity_ReturnsStochasticSoilProfilesWithSamePipingSoilProfile()
{
// Setup
var random = new Random(21);
@@ -115,7 +128,7 @@
}
[Test]
- public void Read_SameStochasticSoilProfileEntityMultipleTimes_ReturnSameStochasticSoilProfile()
+ public void Create_ForTheSameEntityTwice_ReturnsSameObjectInstance()
{
// Setup
var random = new Random(9);
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ReadConversionCollectorTest.cs
===================================================================
diff -u -r8e213638a22dd9f04d965d875bb58156db019be5 -r4afb3d635232a5570c867f890f2c8b4f973ea7f7
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ReadConversionCollectorTest.cs (.../ReadConversionCollectorTest.cs) (revision 8e213638a22dd9f04d965d875bb58156db019be5)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ReadConversionCollectorTest.cs (.../ReadConversionCollectorTest.cs) (revision 4afb3d635232a5570c867f890f2c8b4f973ea7f7)
@@ -39,7 +39,9 @@
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.HeightStructures.Data;
using Ringtoets.HeightStructures.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Data.SoilProfile;
using Ringtoets.MacroStabilityInwards.Primitives;
+using Ringtoets.MacroStabilityInwards.Primitives.TestUtil;
using Ringtoets.Piping.Data.SoilProfile;
using Ringtoets.Piping.Primitives;
using Ringtoets.Piping.Primitives.TestUtil;
@@ -281,6 +283,22 @@
}
[TestFixture]
+ private class PipingStochasticSoilModelCollectorTest : CollectorTest
+ {
+ public PipingStochasticSoilModelCollectorTest() : base(
+ (c, e, m) => c.Read(e, m),
+ (c, e) => c.Contains(e),
+ (c, e) => c.Get(e))
+ { }
+
+ protected override PipingStochasticSoilModel CreateDataModel()
+ {
+ return new PipingStochasticSoilModel(nameof(PipingStochasticSoilModel));
+ }
+ }
+
+ [TestFixture]
private class MacroStabilityInwardsSoilProfileOneDCollectorTest : CollectorTest
{
@@ -334,6 +352,21 @@
}
}
+ [TestFixture]
+ private class MacroStabilityInwardsStochasticSoilProfileCollectorTest : CollectorTest
+ {
+ public MacroStabilityInwardsStochasticSoilProfileCollectorTest() : base(
+ (c, e, m) => c.Read(e, m),
+ (c, e) => c.Contains(e),
+ (c, e) => c.Get(e)) {}
+
+ protected override MacroStabilityInwardsStochasticSoilProfile CreateDataModel()
+ {
+ return new MacroStabilityInwardsStochasticSoilProfile(1, new TestMacroStabilityInwardsSoilProfile1D());
+ }
+ }
+
#region SurfaceLineEntity: Read, Contains, Get
[Test]