Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsStochasticSoilModelTest.cs =================================================================== diff -u -rb13759ad077f9e2b4104de000b5bdeafa9abe358 -raf575930a392dbf1fb1d5073f3df48110af72686 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsStochasticSoilModelTest.cs (.../MacroStabilityInwardsStochasticSoilModelTest.cs) (revision b13759ad077f9e2b4104de000b5bdeafa9abe358) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsStochasticSoilModelTest.cs (.../MacroStabilityInwardsStochasticSoilModelTest.cs) (revision af575930a392dbf1fb1d5073f3df48110af72686) @@ -107,6 +107,27 @@ } [Test] + public void Constructor_StochasticSoilProfilesEmpty_ThrowsArgumentException() + { + // Setup + var random = new Random(21); + const string name = "name"; + var geometry = new[] + { + new Point2D(random.NextDouble(), random.NextDouble()) + }; + + // Call + TestDelegate call = () => new MacroStabilityInwardsStochasticSoilModel(name, + geometry, + Enumerable.Empty()); + + // Assert + string expectedMessage = $"Er zijn geen ondergrondschematisaties gevonden in het stochastische ondergrondmodel '{name}'."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); + } + + [Test] [TestCase("")] [TestCase("segmentSoilModelName")] public void Constructor_WithValidParameters_ExpectedValues(string segmentSoilModelName) @@ -283,10 +304,14 @@ var expectedRemovedProfile = new MacroStabilityInwardsStochasticSoilProfile(0.2, soilProfile); MacroStabilityInwardsStochasticSoilModel model = CreateValidModel(new[] { + CreateStochasticSoilProfile(), expectedRemovedProfile }); - MacroStabilityInwardsStochasticSoilModel otherModel = CreateValidModel(Enumerable.Empty()); + MacroStabilityInwardsStochasticSoilModel otherModel = CreateValidModel(new[] + { + CreateStochasticSoilProfile() + }); // Call MacroStabilityInwardsStochasticSoilModelProfileDifference difference = model.Update(otherModel); @@ -544,7 +569,7 @@ private static MacroStabilityInwardsStochasticSoilProfile CreateStochasticSoilProfile() { var random = new Random(21); - return new MacroStabilityInwardsStochasticSoilProfile(0.5, new TestSoilProfile()); + return new MacroStabilityInwardsStochasticSoilProfile(random.NextDouble(), new TestSoilProfile()); } private static void AssertStochasticSoilModelAreEqual(MacroStabilityInwardsStochasticSoilModel expected,