Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingStochasticSoilModelTransformerTest.cs =================================================================== diff -u -r57bc6a475f6cdd57b1a0ebf70cdf533014afd1ff -rc5c91f8ca724aef52a6cd9055a2a32bcd6bc0c03 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingStochasticSoilModelTransformerTest.cs (.../PipingStochasticSoilModelTransformerTest.cs) (revision 57bc6a475f6cdd57b1a0ebf70cdf533014afd1ff) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingStochasticSoilModelTransformerTest.cs (.../PipingStochasticSoilModelTransformerTest.cs) (revision c5c91f8ca724aef52a6cd9055a2a32bcd6bc0c03) @@ -25,7 +25,6 @@ using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Framework; -using Rhino.Mocks; using Ringtoets.Common.IO.Exceptions; using Ringtoets.Common.IO.SoilProfile; using Ringtoets.Common.IO.SoilProfile.Schema; @@ -273,15 +272,12 @@ [Test] [SetCulture("nl-NL")] - public void Transform_ValidStochasticSoilModelWithSameProfileProbabilityExceedingValidRange_ThrowsImportedDataException() + [TestCaseSource(nameof(GetValidConfiguredAndSupportedSoilProfiles))] + public void Transform_ValidStochasticSoilModelWithSameProfileProbabilityExceedingValidRange_ThrowsImportedDataException(ISoilProfile profile) { // Setup const string soilModelName = "name"; - var mocks = new MockRepository(); - var profile = mocks.Stub(); - mocks.ReplayAll(); - StochasticSoilModel soilModel = StochasticSoilModelTestFactory.CreateStochasticSoilModelWithGeometry(soilModelName, FailureMechanismType.Piping, new[] { new StochasticSoilProfile(0.9, profile), @@ -297,9 +293,7 @@ var exception = Assert.Throws(call); const string expectedMessage = "Het aandeel van de ondergrondschematisatie in het stochastische ondergrondmodel " + "moet in het bereik [0,0, 1,0] liggen."; - Assert.AreEqual(expectedMessage, exception.Message); - - mocks.VerifyAll(); + StringAssert.StartsWith(expectedMessage, exception.Message); } [Test] @@ -370,5 +364,26 @@ .Cast() .Where(t => t != FailureMechanismType.Piping); } + + private static IEnumerable GetValidConfiguredAndSupportedSoilProfiles() + { + var random = new Random(21); + + const long id = 1; + const string name = "test"; + + yield return new SoilProfile2D(id, name, new[] + { + SoilLayer2DTestFactory.CreateSoilLayer2DWithValidAquifer() + }, Enumerable.Empty()) + { + IntersectionX = random.NextDouble() + }; + + yield return new SoilProfile1D(id, name, random.NextDouble(), new[] + { + SoilLayer1DTestFactory.CreateSoilLayer1DWithValidAquifer() + }); + } } } \ No newline at end of file