Index: Ringtoets/Common/src/Ringtoets.Common.Data/IMechanismStochasticSoilModel.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Data/IMechanismStochasticSoilModel.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/IMechanismStochasticSoilModel.cs (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -0,0 +1,28 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+namespace Ringtoets.Common.Data
+{
+ ///
+ /// Interface for a mechanism specific stochastic soil model.
+ ///
+ public interface IMechanismStochasticSoilModel {}
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj
===================================================================
diff -u -rb726f712c5614827e9bfa8041ee40071e02be3b9 -r94ce658a9488c346f114446f0e37dabab7acaa38
--- Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision b726f712c5614827e9bfa8041ee40071e02be3b9)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -85,6 +85,7 @@
+
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj
===================================================================
diff -u -r76d5d269e367c6c3a98802b92d689cebd506a2f2 -r94ce658a9488c346f114446f0e37dabab7acaa38
--- Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 76d5d269e367c6c3a98802b92d689cebd506a2f2)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -147,6 +147,7 @@
+
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/IStochasticSoilModelTransformer.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/IStochasticSoilModelTransformer.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/IStochasticSoilModelTransformer.cs (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -0,0 +1,43 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using Ringtoets.Common.Data;
+using Ringtoets.Common.IO.Exceptions;
+
+namespace Ringtoets.Common.IO.SoilProfile
+{
+ ///
+ /// Interface for transforming generic stochastic soil models into mechanism specific stochastic soil models.
+ ///
+ /// The type of the mechanism specific stochastic soil model.
+ public interface IStochasticSoilModelTransformer where T : IMechanismStochasticSoilModel
+ {
+ ///
+ /// Transforms the generic into a mechanism specific
+ /// stochastic soil model of type .
+ ///
+ /// The stochastic soil model to use in the transformation.
+ /// A new based on the given data.
+ /// Thrown when transformation would not result
+ /// in a valid transformed instance.
+ T Transform(StochasticSoilModel stochasticSoilModel);
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj
===================================================================
diff -u -raa49537188229065df91b1a931f088c32115702a -r94ce658a9488c346f114446f0e37dabab7acaa38
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision aa49537188229065df91b1a931f088c32115702a)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -60,6 +60,8 @@
+
+
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/SoilProfile/PipingStochasticSoilModel.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/SoilProfile/PipingStochasticSoilModel.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/SoilProfile/PipingStochasticSoilModel.cs (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -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.Collections.Generic;
+using Core.Common.Base;
+using Core.Common.Base.Geometry;
+using Ringtoets.Common.Data;
+using Ringtoets.Piping.Data.SoilProfile;
+
+namespace Ringtoets.Piping.Primitives
+{
+ ///
+ /// This class represents a piping specific stochastic soil model which consists out of a
+ /// collection of .
+ /// A stochastic soil model contains a segment for which the model applies.
+ ///
+ public class PipingStochasticSoilModel : Observable, IMechanismStochasticSoilModel
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// Name of the segment soil model.
+ public PipingStochasticSoilModel(string name)
+ {
+ Name = name;
+ Geometry = new List();
+ StochasticSoilProfiles = new List();
+ }
+
+ ///
+ /// Gets the name of the soil model.
+ ///
+ public string Name { get; }
+
+ ///
+ /// Gets the list of geometry points.
+ ///
+ public List Geometry { get; }
+
+ ///
+ /// Gets the list of .
+ ///
+ public List StochasticSoilProfiles { get; }
+
+ public override string ToString()
+ {
+ return Name;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/SoilProfile/PipingStochasticSoilProfile.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/SoilProfile/PipingStochasticSoilProfile.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/SoilProfile/PipingStochasticSoilProfile.cs (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -0,0 +1,122 @@
+// 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.Globalization;
+using Core.Common.Base;
+using Core.Common.Base.Data;
+using Ringtoets.Piping.Data.Properties;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.Data.SoilProfile
+{
+ ///
+ /// This class couples a to a probability of occurrence.
+ ///
+ public class PipingStochasticSoilProfile : Observable
+ {
+ private static readonly Range probabilityValidityRange = new Range(0, 1);
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// Probability of the stochastic soil profile.
+ /// The soil profile.
+ /// Thrown when is null.
+ /// Thrown when the
+ /// is outside the range [0, 1].
+ public PipingStochasticSoilProfile(double probability, PipingSoilProfile soilProfile)
+ {
+ if (soilProfile == null)
+ {
+ throw new ArgumentNullException(nameof(soilProfile));
+ }
+
+ ValidateProbability(probability);
+
+ Probability = probability;
+ SoilProfile = soilProfile;
+ }
+
+ ///
+ /// Gets the probability of the stochastic soil profile.
+ ///
+ public double Probability { get; }
+
+ ///
+ /// Gets the .
+ ///
+ public PipingSoilProfile SoilProfile { get; }
+
+ public override string ToString()
+ {
+ return SoilProfile.ToString();
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj))
+ {
+ return false;
+ }
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+ var other = obj as PipingStochasticSoilProfile;
+ return other != null && Equals(other);
+ }
+
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ int hashCode = Probability.GetHashCode();
+ hashCode = (hashCode * 397) ^ (SoilProfile?.GetHashCode() ?? 0);
+ return hashCode;
+ }
+ }
+
+ ///
+ /// Checks that is valid.
+ ///
+ /// Probability of the stochastic soil profile.
+ /// Thrown when the
+ /// is outside the range [0, 1].
+ private static void ValidateProbability(double probability)
+ {
+ if (!probabilityValidityRange.InRange(probability))
+ {
+ throw new ArgumentOutOfRangeException(
+ nameof(probability),
+ string.Format(
+ Resources.StochasticSoilProfile_Probability_Should_be_in_range_0_,
+ probabilityValidityRange.ToString(FormattableConstants.ShowAtLeastOneDecimal, CultureInfo.CurrentCulture)));
+ }
+ }
+
+ private bool Equals(PipingStochasticSoilProfile other)
+ {
+ return Probability.Equals(other.Probability)
+ && Equals(SoilProfile, other.SoilProfile);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingStochasticSoilModelTransformer.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingStochasticSoilModelTransformer.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingStochasticSoilModelTransformer.cs (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -0,0 +1,37 @@
+// 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 Ringtoets.Common.IO.SoilProfile;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.IO.Importers
+{
+ ///
+ /// Transforms generic into .
+ ///
+ public class PipingStochasticSoilModelTransformer : IStochasticSoilModelTransformer
+ {
+ public PipingStochasticSoilModel Transform(StochasticSoilModel stochasticSoilModel)
+ {
+ return null;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj
===================================================================
diff -u -rb2d6fb0b948754d598692e76e2dc1a25b311d7e7 -r94ce658a9488c346f114446f0e37dabab7acaa38
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision b2d6fb0b948754d598692e76e2dc1a25b311d7e7)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -50,6 +50,7 @@
+
Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/SoilProfileType.cs
===================================================================
diff -u -r81fa8a9bf3bd503cbd280e88b8f6037a840cff12 -r94ce658a9488c346f114446f0e37dabab7acaa38
--- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/SoilProfileType.cs (.../SoilProfileType.cs) (revision 81fa8a9bf3bd503cbd280e88b8f6037a840cff12)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/SoilProfileType.cs (.../SoilProfileType.cs) (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -32,7 +32,7 @@
SoilProfile1D = 1,
///
- /// One dimensional soil profile.
+ /// Two dimensional soil profile.
///
SoilProfile2D = 2
}
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj
===================================================================
diff -u -raa49537188229065df91b1a931f088c32115702a -r94ce658a9488c346f114446f0e37dabab7acaa38
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision aa49537188229065df91b1a931f088c32115702a)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -72,6 +72,8 @@
+
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/SoilProfile/PipingStochasticSoilModelTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/SoilProfile/PipingStochasticSoilModelTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/SoilProfile/PipingStochasticSoilModelTest.cs (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -0,0 +1,51 @@
+// 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 Core.Common.Base;
+using NUnit.Framework;
+using Ringtoets.Common.Data;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.Data.Test.SoilProfile
+{
+ [TestFixture]
+ public class PipingStochasticSoilModelTest
+ {
+ [Test]
+ public void Constructor_ValidName_ExpectedValues()
+ {
+ // Setup
+ const string name = "name";
+
+ // Call
+ var model = new PipingStochasticSoilModel(name);
+
+ // Assert
+ Assert.IsInstanceOf(model);
+ Assert.IsInstanceOf(model);
+
+ Assert.AreEqual(name, model.Name);
+ CollectionAssert.IsEmpty(model.Geometry);
+ CollectionAssert.IsEmpty(model.StochasticSoilProfiles);
+ Assert.AreEqual(name, model.ToString());
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/SoilProfile/PipingStochasticSoilProfileTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/SoilProfile/PipingStochasticSoilProfileTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/SoilProfile/PipingStochasticSoilProfileTest.cs (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -0,0 +1,203 @@
+// 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 Core.Common.Base;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Piping.Data.SoilProfile;
+using Ringtoets.Piping.Data.TestUtil;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.Data.Test.SoilProfile
+{
+ [TestFixture]
+ public class PipingStochasticSoilProfileTest
+ {
+ [Test]
+ public void Constructor_SoilProfileNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new PipingStochasticSoilProfile(0.0, null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("soilProfile", exception.ParamName);
+ }
+
+ [Test]
+ [TestCase(0.0)]
+ [TestCase(0.5)]
+ [TestCase(1.0)]
+ public void Constructor_WithValidProbabilities_ExpectedValues(double probability)
+ {
+ // Setup
+ PipingSoilProfile profile = PipingSoilProfileTestFactory.CreatePipingSoilProfile();
+
+ // Call
+ var stochasticSoilProfile = new PipingStochasticSoilProfile(probability, profile);
+
+ // Assert
+ Assert.IsInstanceOf(stochasticSoilProfile);
+ Assert.AreEqual(probability, stochasticSoilProfile.Probability);
+ Assert.AreSame(profile, stochasticSoilProfile.SoilProfile);
+ Assert.AreEqual(profile.ToString(), stochasticSoilProfile.ToString());
+ }
+
+ [Test]
+ [SetCulture("nl-NL")]
+ [TestCase(12.5)]
+ [TestCase(1 + 1e-6)]
+ [TestCase(0 - 1e-6)]
+ [TestCase(-66.3)]
+ [TestCase(double.NaN)]
+ public void Constructor_WithInvalidProbabilities_ThrowsArgumentOutOfRangeException(double probability)
+ {
+ // Setup
+ PipingSoilProfile profile = PipingSoilProfileTestFactory.CreatePipingSoilProfile();
+
+ // Call
+ TestDelegate test = () => new PipingStochasticSoilProfile(probability, profile);
+
+ // Assert
+ const string expectedMessage = "Het aandeel van de ondergrondschematisatie in het stochastische ondergrondmodel moet in het bereik [0,0, 1,0] liggen.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ [Test]
+ public void Equals_OtherType_ReturnsFalse()
+ {
+ // Setup
+ PipingSoilProfile profile = PipingSoilProfileTestFactory.CreatePipingSoilProfile();
+ var stochasticProfile = new PipingStochasticSoilProfile(0.0, profile);
+
+ // Call
+ bool areEqual = stochasticProfile.Equals(new object());
+
+ // Assert
+ Assert.IsFalse(areEqual);
+ }
+
+ [Test]
+ public void Equals_Null_ReturnsFalse()
+ {
+ // Setup
+ PipingSoilProfile profile = PipingSoilProfileTestFactory.CreatePipingSoilProfile();
+ var stochasticProfile = new PipingStochasticSoilProfile(0.0, profile);
+
+ // Call
+ bool areEqual = stochasticProfile.Equals(null);
+
+ // Assert
+ Assert.IsFalse(areEqual);
+ }
+
+ [Test]
+ [TestCaseSource(nameof(StochasticProfileCombinations))]
+ public void Equals_DifferentScenarios_ReturnsTrue(PipingStochasticSoilProfile profile,
+ PipingStochasticSoilProfile otherProfile,
+ bool expectedEqual)
+ {
+ // Call
+ bool areEqualOne = profile.Equals(otherProfile);
+ bool areEqualTwo = otherProfile.Equals(profile);
+
+ // Assert
+ Assert.AreEqual(expectedEqual, areEqualOne);
+ Assert.AreEqual(expectedEqual, areEqualTwo);
+ }
+
+ [Test]
+ public void GetHashCode_EqualPipingStochasticSoilProfiles_ReturnSameHashCode()
+ {
+ // Setup
+ PipingSoilProfile profile = PipingSoilProfileTestFactory.CreatePipingSoilProfile();
+ var stochasticSoilProfileA = new PipingStochasticSoilProfile(0.2, profile);
+ var stochasticSoilProfileB = new PipingStochasticSoilProfile(0.2, profile);
+
+ // Call
+ int hashCodeOne = stochasticSoilProfileA.GetHashCode();
+ int hashCodeTwo = stochasticSoilProfileB.GetHashCode();
+
+ // Assert
+ Assert.AreEqual(hashCodeOne, hashCodeTwo);
+ }
+
+ private static TestCaseData[] StochasticProfileCombinations()
+ {
+ PipingStochasticSoilProfile profileA = CreateRandomStochasticProfile(21);
+ PipingStochasticSoilProfile profileB = CreateRandomStochasticProfile(21);
+ PipingStochasticSoilProfile profileC = CreateRandomStochasticProfile(73);
+
+ return new[]
+ {
+ new TestCaseData(profileA, profileA, true)
+ {
+ TestName = "Equals_SameProfile_ReturnsTrue"
+ },
+ new TestCaseData(profileA, profileB, true)
+ {
+ TestName = "Equals_ProfileAProfileB_ReturnsTrue"
+ },
+ new TestCaseData(profileB, profileC, false)
+ {
+ TestName = "Equals_ProfileBProfileC_ReturnsFalse"
+ },
+ new TestCaseData(profileA, profileC, false)
+ {
+ TestName = "Equals_ProfileAProfileC_ReturnsFalse"
+ }
+ };
+ }
+
+ private static PipingStochasticSoilProfile CreateRandomStochasticProfile(int randomSeed)
+ {
+ var random = new Random(randomSeed);
+ return new PipingStochasticSoilProfile(random.NextDouble(), CreateRandomProfile(random));
+ }
+
+ private static PipingSoilProfile CreateRandomProfile(Random random)
+ {
+ return new PipingSoilProfile(GetRandomName(random), -1.0 - random.NextDouble(), new[]
+ {
+ new PipingSoilLayer(random.NextDouble())
+ {
+ MaterialName = GetRandomName(random),
+ Color = Color.FromKnownColor(random.NextEnumValue()),
+ IsAquifer = random.NextBoolean(),
+ BelowPhreaticLevelDeviation = random.NextDouble(),
+ BelowPhreaticLevelMean = random.NextDouble(),
+ BelowPhreaticLevelShift = random.NextDouble(),
+ DiameterD70CoefficientOfVariation = random.NextDouble(),
+ DiameterD70Mean = random.NextDouble(),
+ PermeabilityCoefficientOfVariation = random.NextDouble(),
+ PermeabilityMean = random.NextDouble()
+ }
+ }, random.NextEnumValue(), random.Next());
+ }
+
+ private static string GetRandomName(Random random)
+ {
+ return new string('x', random.Next(0, 40));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingSoilProfileTestFactory.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingSoilProfileTestFactory.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingSoilProfileTestFactory.cs (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -0,0 +1,43 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.Data.TestUtil
+{
+ ///
+ /// Factory to create simple instances that can be used for testing.
+ ///
+ public static class PipingSoilProfileTestFactory
+ {
+ ///
+ /// Creates a new instance of with arbitrary values.
+ ///
+ /// The created .
+ public static PipingSoilProfile CreatePipingSoilProfile()
+ {
+ return new PipingSoilProfile("name", 0.0, new[]
+ {
+ new PipingSoilLayer(1.0)
+ }, SoilProfileType.SoilProfile1D, 0L);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/Ringtoets.Piping.Data.TestUtil.csproj
===================================================================
diff -u -r6456699cf3b6e52dad3a92aaa3c6714fad072a96 -r94ce658a9488c346f114446f0e37dabab7acaa38
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/Ringtoets.Piping.Data.TestUtil.csproj (.../Ringtoets.Piping.Data.TestUtil.csproj) (revision 6456699cf3b6e52dad3a92aaa3c6714fad072a96)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/Ringtoets.Piping.Data.TestUtil.csproj (.../Ringtoets.Piping.Data.TestUtil.csproj) (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -52,6 +52,7 @@
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingStochasticSoilModelTransformerTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingStochasticSoilModelTransformerTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingStochasticSoilModelTransformerTest.cs (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -0,0 +1,42 @@
+// 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 NUnit.Framework;
+using Ringtoets.Common.IO.SoilProfile;
+using Ringtoets.Piping.IO.Importers;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.IO.Test.Importers
+{
+ [TestFixture]
+ public class PipingStochasticSoilModelTransformerTest
+ {
+ [Test]
+ public void Constructor_ValidProperties_ExpectedValues()
+ {
+ // Call
+ var transformer = new PipingStochasticSoilModelTransformer();
+
+ // Assert
+ Assert.IsInstanceOf>(transformer);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj
===================================================================
diff -u -rb2d6fb0b948754d598692e76e2dc1a25b311d7e7 -r94ce658a9488c346f114446f0e37dabab7acaa38
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision b2d6fb0b948754d598692e76e2dc1a25b311d7e7)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision 94ce658a9488c346f114446f0e37dabab7acaa38)
@@ -78,6 +78,7 @@
+