Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs =================================================================== diff -u -rda4a311b2ac60defe1a27a61c8d151f47268a941 -ra20f5008f39cfa4fd6f94572fd07a011f76609f4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs (.../MacroStabilityInwardsInputContextPropertiesTest.cs) (revision da4a311b2ac60defe1a27a61c8d151f47268a941) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs (.../MacroStabilityInwardsInputContextPropertiesTest.cs) (revision a20f5008f39cfa4fd6f94572fd07a011f76609f4) @@ -41,6 +41,7 @@ using Ringtoets.Common.Forms.UITypeEditors; using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile; using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects; using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; @@ -365,8 +366,12 @@ } } })); - var stochasticSoilModel = new MacroStabilityInwardsStochasticSoilModel("StochasticSoilModelName"); - stochasticSoilModel.StochasticSoilProfiles.Add(stochasticSoilProfile); + MacroStabilityInwardsStochasticSoilModel stochasticSoilModel = + MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel("StochasticSoilModelName", + new[] + { + stochasticSoilProfile + }); HydraulicBoundaryLocation testHydraulicBoundaryLocation = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(0.0); @@ -854,7 +859,8 @@ MacroStabilityInwardsSurfaceLine testSurfaceLine = ValidSurfaceLine(0, 2); MacroStabilityInwardsSoilProfile1D soilProfile = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D(); var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(0.0, soilProfile); - var stochasticSoilModel = new MacroStabilityInwardsStochasticSoilModel("StochasticSoilModelName"); + MacroStabilityInwardsStochasticSoilModel stochasticSoilModel = + MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel("StochasticSoilModelName"); stochasticSoilModel.StochasticSoilProfiles.Add(stochasticSoilProfile); var calculationItem = new MacroStabilityInwardsCalculationScenario @@ -900,8 +906,12 @@ MacroStabilityInwardsSoilProfile1D soilProfile = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D(); var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(0.0, soilProfile); - var stochasticSoilModel = new MacroStabilityInwardsStochasticSoilModel("StochasticSoilModelName"); - stochasticSoilModel.StochasticSoilProfiles.Add(stochasticSoilProfile); + MacroStabilityInwardsStochasticSoilModel stochasticSoilModel = + MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel("StochasticSoilModelName", + new[] + { + stochasticSoilProfile + }); var calculationItem = new MacroStabilityInwardsCalculationScenario { InputParameters = @@ -941,7 +951,7 @@ } [Test] - public void StochasticSoilProfile_DifferentStochasticSoilModel_SoilProfileSetToNull() + public void StochasticSoilProfile_DifferentStochasticSoilModelWithOneProfile_SetsSoilProfileSetToProfileOfNewModel() { // Setup var mocks = new MockRepository(); @@ -953,13 +963,21 @@ MacroStabilityInwardsSurfaceLine testSurfaceLine = ValidSurfaceLine(0, 2); MacroStabilityInwardsSoilProfile1D soilProfile1 = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D(); var stochasticSoilProfile1 = new MacroStabilityInwardsStochasticSoilProfile(0.0, soilProfile1); - var stochasticSoilModel1 = new MacroStabilityInwardsStochasticSoilModel("StochasticSoilModel1Name"); - stochasticSoilModel1.StochasticSoilProfiles.Add(stochasticSoilProfile1); + MacroStabilityInwardsStochasticSoilModel stochasticSoilModel1 = + MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel("StochasticSoilModel1Name", + new[] + { + stochasticSoilProfile1 + }); MacroStabilityInwardsSoilProfile1D soilProfile2 = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D(); var stochasticSoilProfile2 = new MacroStabilityInwardsStochasticSoilProfile(0.0, soilProfile2); - var stochasticSoilModel2 = new MacroStabilityInwardsStochasticSoilModel("StochasticSoilModel2Name"); - stochasticSoilModel1.StochasticSoilProfiles.Add(stochasticSoilProfile2); + MacroStabilityInwardsStochasticSoilModel stochasticSoilModel2 = + MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel("StochasticSoilModel2Name", + new[] + { + stochasticSoilProfile2 + }); var calculationItem = new MacroStabilityInwardsCalculationScenario { @@ -992,7 +1010,7 @@ properties.StochasticSoilModel = stochasticSoilModel2; // Assert - Assert.IsNull(inputParameters.StochasticSoilProfile); + Assert.AreSame(stochasticSoilProfile2, inputParameters.StochasticSoilProfile); mocks.VerifyAll(); } @@ -1079,8 +1097,8 @@ }, new MacroStabilityInwardsStochasticSoilModel("C", new[] { - new Point2D(2, -1), - new Point2D(2, 1) + new Point2D(-2, -1), + new Point2D(-2, 1) }) { StochasticSoilProfiles = @@ -1167,14 +1185,12 @@ mocks.ReplayAll(); var failureMechanism = new MacroStabilityInwardsFailureMechanism(); - var model = new MacroStabilityInwardsStochasticSoilModel("A") - { - StochasticSoilProfiles = - { - new MacroStabilityInwardsStochasticSoilProfile( - 1.0, MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D()) - } - }; + MacroStabilityInwardsStochasticSoilModel model = + MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel("A"); + model.StochasticSoilProfiles.Add(new MacroStabilityInwardsStochasticSoilProfile( + 1.0, MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D()) + ); + var calculation = new MacroStabilityInwardsCalculationScenario { InputParameters =