Index: Ringtoets/Integration/test/Ringtoets.Integration.TestUtils.Test/DataImportHelperTest.cs =================================================================== diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -rbcad3e9362f5130ab5f29dad05ec17a6812d859a --- Ringtoets/Integration/test/Ringtoets.Integration.TestUtils.Test/DataImportHelperTest.cs (.../DataImportHelperTest.cs) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9) +++ Ringtoets/Integration/test/Ringtoets.Integration.TestUtils.Test/DataImportHelperTest.cs (.../DataImportHelperTest.cs) (revision bcad3e9362f5130ab5f29dad05ec17a6812d859a) @@ -258,10 +258,10 @@ // Assert CollectionAssert.AreEqual(new[] { - "PK001_0001_Piping", - "PK001_0002_Piping", - "PK001_0003_Piping", - "PK001_0004_Piping" + "PK001_0001_Stability", + "PK001_0002_Stability", + "PK001_0003_Stability", + "PK001_0004_Stability" }, dikeSection.MacroStabilityInwards.StochasticSoilModels.Select(sm => sm.Name)); CollectionAssert.AreEqual(new[] { Index: Ringtoets/Integration/test/Ringtoets.Integration.TestUtils.Test/DataUpdateHelperTest.cs =================================================================== diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -rbcad3e9362f5130ab5f29dad05ec17a6812d859a --- Ringtoets/Integration/test/Ringtoets.Integration.TestUtils.Test/DataUpdateHelperTest.cs (.../DataUpdateHelperTest.cs) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9) +++ Ringtoets/Integration/test/Ringtoets.Integration.TestUtils.Test/DataUpdateHelperTest.cs (.../DataUpdateHelperTest.cs) (revision bcad3e9362f5130ab5f29dad05ec17a6812d859a) @@ -81,29 +81,31 @@ // Assert CollectionAssert.AreEqual(new[] { - "PK001_0001_Piping", - "PK001_0002_Piping", - "PK001_0003_Piping" + "PK001_0001_Stability", + "PK001_0002_Stability", + "PK001_0003_Stability", + "PK001_0004_Stability" }, dikeSection.MacroStabilityInwards.StochasticSoilModels.Select(sm => sm.Name)); CollectionAssert.AreEqual(new[] { 1, - 2, + 1, + 1, 1 }, dikeSection.MacroStabilityInwards.StochasticSoilModels.Select(sm => sm.StochasticSoilProfiles.Count)); CollectionAssert.AreEqual(new[] { - 0.5, - 0.5, - 0.5, + 1.0, + 1.0, + 1.0, 1.0 }, dikeSection.MacroStabilityInwards.StochasticSoilModels.SelectMany(sm => sm.StochasticSoilProfiles.Select(sp => sp.Probability))); CollectionAssert.AreEqual(new[] { "W1-6_0_1D1", - "W1-6_0_1D1", + "W1-6_4_1D1", "W1-7_0_1D1", - "W1-7_0_1D1" + "W1-8_6_1D1" }, dikeSection.MacroStabilityInwards.StochasticSoilModels.SelectMany(sm => sm.StochasticSoilProfiles.Select(sp => sp.SoilProfile.Name))); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataImportHelper.cs =================================================================== diff -u -r09693d79085118c47709b7059ab7c1ef459ad2aa -rbcad3e9362f5130ab5f29dad05ec17a6812d859a --- Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataImportHelper.cs (.../DataImportHelper.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa) +++ Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataImportHelper.cs (.../DataImportHelper.cs) (revision bcad3e9362f5130ab5f29dad05ec17a6812d859a) @@ -274,12 +274,12 @@ "DR6.soil")) { string filePath = Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "DR6.soil"); - var activity = new FileImportActivity(new StochasticSoilModelImporter( + var activity = new FileImportActivity(new StochasticSoilModelImporter( assessmentSection.MacroStabilityInwards.StochasticSoilModels, filePath, new ImportMessageProvider(), - new StochasticSoilModelReplaceDataStrategy(assessmentSection.MacroStabilityInwards)), - "StochasticSoilModelImporter"); + MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(assessmentSection.MacroStabilityInwards)), + "MacroStabilityInwardsStochasticSoilModelImporter"); activity.Run(); activity.Finish(); } Index: Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataUpdateHelper.cs =================================================================== diff -u -r09693d79085118c47709b7059ab7c1ef459ad2aa -rbcad3e9362f5130ab5f29dad05ec17a6812d859a --- Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataUpdateHelper.cs (.../DataUpdateHelper.cs) (revision 09693d79085118c47709b7059ab7c1ef459ad2aa) +++ Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataUpdateHelper.cs (.../DataUpdateHelper.cs) (revision bcad3e9362f5130ab5f29dad05ec17a6812d859a) @@ -84,12 +84,12 @@ "DR6_updated.soil")) { string filePath = Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "DR6_updated.soil"); - var activity = new FileImportActivity(new StochasticSoilModelImporter( + var activity = new FileImportActivity(new StochasticSoilModelImporter( assessmentSection.MacroStabilityInwards.StochasticSoilModels, filePath, - new UpdateMessageProvider(), - new StochasticSoilModelUpdateDataStrategy(assessmentSection.MacroStabilityInwards)), - "StochasticSoilModelUpdater"); + new ImportMessageProvider(), + MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.CreateUpdateStrategyConfiguration(assessmentSection.MacroStabilityInwards)), + "MacroStabilityInwardsStochasticSoilModelUpdater"); activity.Run(); activity.Finish(); } Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs =================================================================== diff -u -r78382ec129ddc7537096860680cef36f3796700d -rbcad3e9362f5130ab5f29dad05ec17a6812d859a --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision 78382ec129ddc7537096860680cef36f3796700d) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision bcad3e9362f5130ab5f29dad05ec17a6812d859a) @@ -40,6 +40,7 @@ using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Forms.TreeNodeInfos; using Ringtoets.Common.IO.FileImporters.MessageProviders; +using Ringtoets.Common.IO.SoilProfile; using Ringtoets.Common.IO.SurfaceLines; using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; @@ -48,7 +49,6 @@ using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; using Ringtoets.MacroStabilityInwards.Forms.Views; using Ringtoets.MacroStabilityInwards.IO.Configurations; -using Ringtoets.MacroStabilityInwards.IO.Importers; using Ringtoets.MacroStabilityInwards.Plugin.FileImporter; using Ringtoets.MacroStabilityInwards.Plugin.Properties; using Ringtoets.MacroStabilityInwards.Primitives; @@ -112,7 +112,12 @@ Image = MacroStabilityInwardsFormsResources.SoilProfileIcon, FileFilterGenerator = StochasticSoilModelFileFilter, IsEnabled = context => context.AssessmentSection.ReferenceLine != null, - CreateFileImporter = (context, filePath) => StochasticSoilModelImporter(context, filePath, new ImportMessageProvider(), new StochasticSoilModelReplaceDataStrategy(context.FailureMechanism)), + CreateFileImporter = (context, filePath) => new StochasticSoilModelImporter( + context.WrappedData, + filePath, + new ImportMessageProvider(), + MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(context.FailureMechanism) + ), VerifyUpdates = context => VerifyStochasticSoilModelUpdates(context, Resources.MacroStabilityInwardsPlugin_VerifyStochasticSoilModelImport_When_importing_StochasticSoilModels_calculation_output_will_be_cleared_confirm) }; @@ -164,7 +169,12 @@ FileFilterGenerator = StochasticSoilModelFileFilter, IsEnabled = context => context.WrappedData.SourcePath != null, CurrentPath = context => context.WrappedData.SourcePath, - CreateFileImporter = (context, filePath) => StochasticSoilModelImporter(context, filePath, new UpdateMessageProvider(), new StochasticSoilModelUpdateDataStrategy(context.FailureMechanism)), + CreateFileImporter = (context, filePath) => new StochasticSoilModelImporter( + context.WrappedData, + filePath, + new UpdateMessageProvider(), + MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.CreateUpdateStrategyConfiguration(context.FailureMechanism) + ), VerifyUpdates = context => VerifyStochasticSoilModelUpdates( context, @@ -354,15 +364,6 @@ } } - private static StochasticSoilModelImporter StochasticSoilModelImporter(StochasticSoilModelCollectionContext context, string filePath, - IImporterMessageProvider messageProvider, IStochasticSoilModelUpdateModelStrategy updateStrategy) - { - return new StochasticSoilModelImporter(context.WrappedData, - filePath, - messageProvider, - updateStrategy); - } - private bool VerifyStochasticSoilModelUpdates(StochasticSoilModelCollectionContext context, string query) { var changeHandler = new FailureMechanismCalculationChangeHandler(context.FailureMechanism, Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.Test/MacroStabilityInwardsCalculationsViewIntegrationTest.cs =================================================================== diff -u -r0c5fdf3803fc373c20aa5e12fd180247797e15e2 -rbcad3e9362f5130ab5f29dad05ec17a6812d859a --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.Test/MacroStabilityInwardsCalculationsViewIntegrationTest.cs (.../MacroStabilityInwardsCalculationsViewIntegrationTest.cs) (revision 0c5fdf3803fc373c20aa5e12fd180247797e15e2) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Integration.Test/MacroStabilityInwardsCalculationsViewIntegrationTest.cs (.../MacroStabilityInwardsCalculationsViewIntegrationTest.cs) (revision bcad3e9362f5130ab5f29dad05ec17a6812d859a) @@ -97,9 +97,9 @@ // Import soil models and profiles and ensure the corresponding combobox items are updated DataImportHelper.ImportMacroStabilityInwardsStochasticSoilModels(assessmentSection); MacroStabilityInwardsStochasticSoilModelCollection stochasticSoilModelCollection = assessmentSection.MacroStabilityInwards.StochasticSoilModels; - calculation1.InputParameters.StochasticSoilModel = stochasticSoilModelCollection.First(sl => sl.Name == "PK001_0001_Piping"); + calculation1.InputParameters.StochasticSoilModel = stochasticSoilModelCollection.First(sl => sl.Name == "PK001_0001_Stability"); Assert.AreEqual(2, ((DataGridViewComboBoxCell) dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex]).Items.Count); - Assert.AreEqual("PK001_0001_Piping", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); + Assert.AreEqual("PK001_0001_Stability", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); Assert.AreEqual(1, ((DataGridViewComboBoxCell) dataGridView.Rows[0].Cells[stochasticSoilProfilesColumnIndex]).Items.Count); Assert.AreEqual("", dataGridView.Rows[0].Cells[stochasticSoilProfilesColumnIndex].FormattedValue); @@ -145,7 +145,7 @@ calculation1.InputParameters.StochasticSoilModel = stochasticSoilModelCollection[0]; calculation1.InputParameters.StochasticSoilProfile = stochasticSoilModelCollection[0].StochasticSoilProfiles[0]; calculation1.InputParameters.NotifyObservers(); - Assert.AreEqual("PK001_0001_Piping", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); + Assert.AreEqual("PK001_0001_Stability", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); Assert.AreEqual("W1-6_0_1D1", dataGridView.Rows[0].Cells[stochasticSoilProfilesColumnIndex].FormattedValue); Assert.AreEqual("100", dataGridView.Rows[0].Cells[stochasticSoilProfilesProbabilityColumnIndex].FormattedValue); @@ -154,7 +154,7 @@ calculation2.InputParameters.StochasticSoilModel = stochasticSoilModelCollection[1]; calculation2.InputParameters.StochasticSoilProfile = stochasticSoilModelCollection[1].StochasticSoilProfiles[0]; calculation2.InputParameters.NotifyObservers(); - Assert.AreEqual("PK001_0002_Piping", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); + Assert.AreEqual("PK001_0002_Stability", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); Assert.AreEqual("W1-6_4_1D1", dataGridView.Rows[0].Cells[stochasticSoilProfilesColumnIndex].FormattedValue); Assert.AreEqual("100", dataGridView.Rows[0].Cells[stochasticSoilProfilesProbabilityColumnIndex].FormattedValue); @@ -163,7 +163,7 @@ calculation3.InputParameters.StochasticSoilModel = stochasticSoilModelCollection[2]; calculation3.InputParameters.StochasticSoilProfile = stochasticSoilModelCollection[2].StochasticSoilProfiles[0]; calculation3.InputParameters.NotifyObservers(); - Assert.AreEqual("PK001_0003_Piping", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); + Assert.AreEqual("PK001_0003_Stability", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); Assert.AreEqual("W1-7_0_1D1", dataGridView.Rows[0].Cells[stochasticSoilProfilesColumnIndex].FormattedValue); Assert.AreEqual("100", dataGridView.Rows[0].Cells[stochasticSoilProfilesProbabilityColumnIndex].FormattedValue); @@ -172,32 +172,32 @@ calculation4.InputParameters.StochasticSoilModel = stochasticSoilModelCollection[3]; calculation4.InputParameters.StochasticSoilProfile = stochasticSoilModelCollection[3].StochasticSoilProfiles[0]; calculation4.InputParameters.NotifyObservers(); - Assert.AreEqual("PK001_0004_Piping", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); + Assert.AreEqual("PK001_0004_Stability", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); Assert.AreEqual("W1-8_6_1D1", dataGridView.Rows[0].Cells[stochasticSoilProfilesColumnIndex].FormattedValue); Assert.AreEqual("100", dataGridView.Rows[0].Cells[stochasticSoilProfilesProbabilityColumnIndex].FormattedValue); // Update stochastic soil models DataUpdateHelper.UpdateMacroStabilityInwardsStochasticSoilModels(assessmentSection); listBox.SelectedItem = assessmentSection.MacroStabilityInwards.Sections.First(s => s.Name == "6-3_22"); - Assert.AreEqual("PK001_0001_Piping", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); + Assert.AreEqual("PK001_0001_Stability", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); Assert.AreEqual("W1-6_0_1D1", dataGridView.Rows[0].Cells[stochasticSoilProfilesColumnIndex].FormattedValue); - Assert.AreEqual("50", dataGridView.Rows[0].Cells[stochasticSoilProfilesProbabilityColumnIndex].FormattedValue); + Assert.AreEqual("100", dataGridView.Rows[0].Cells[stochasticSoilProfilesProbabilityColumnIndex].FormattedValue); listBox.SelectedItem = assessmentSection.MacroStabilityInwards.Sections.First(s => s.Name == "6-3_19"); - Assert.AreEqual("PK001_0002_Piping", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); - Assert.AreEqual("", dataGridView.Rows[0].Cells[stochasticSoilProfilesColumnIndex].FormattedValue); - Assert.AreEqual("0", dataGridView.Rows[0].Cells[stochasticSoilProfilesProbabilityColumnIndex].FormattedValue); + Assert.AreEqual("PK001_0002_Stability", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); + Assert.AreEqual("W1-6_4_1D1", dataGridView.Rows[0].Cells[stochasticSoilProfilesColumnIndex].FormattedValue); + Assert.AreEqual("100", dataGridView.Rows[0].Cells[stochasticSoilProfilesProbabilityColumnIndex].FormattedValue); listBox.SelectedItem = assessmentSection.MacroStabilityInwards.Sections.First(s => s.Name == "6-3_16"); - Assert.AreEqual("PK001_0003_Piping", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); + Assert.AreEqual("PK001_0003_Stability", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); Assert.AreEqual("W1-7_0_1D1", dataGridView.Rows[0].Cells[stochasticSoilProfilesColumnIndex].FormattedValue); Assert.AreEqual("100", dataGridView.Rows[0].Cells[stochasticSoilProfilesProbabilityColumnIndex].FormattedValue); listBox.SelectedItem = assessmentSection.MacroStabilityInwards.Sections.First(s => s.Name == "6-3_8"); - Assert.AreEqual("", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); - Assert.AreEqual("", dataGridView.Rows[0].Cells[stochasticSoilProfilesColumnIndex].FormattedValue); - Assert.AreEqual("0", dataGridView.Rows[0].Cells[stochasticSoilProfilesProbabilityColumnIndex].FormattedValue); + Assert.AreEqual("PK001_0004_Stability", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); + Assert.AreEqual("W1-8_6_1D1", dataGridView.Rows[0].Cells[stochasticSoilProfilesColumnIndex].FormattedValue); + Assert.AreEqual("100", dataGridView.Rows[0].Cells[stochasticSoilProfilesProbabilityColumnIndex].FormattedValue); } } } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ImportInfos/StochasticSoilModelCollectionContextImportInfoTest.cs =================================================================== diff -u -r78382ec129ddc7537096860680cef36f3796700d -rbcad3e9362f5130ab5f29dad05ec17a6812d859a --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ImportInfos/StochasticSoilModelCollectionContextImportInfoTest.cs (.../StochasticSoilModelCollectionContextImportInfoTest.cs) (revision 78382ec129ddc7537096860680cef36f3796700d) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ImportInfos/StochasticSoilModelCollectionContextImportInfoTest.cs (.../StochasticSoilModelCollectionContextImportInfoTest.cs) (revision bcad3e9362f5130ab5f29dad05ec17a6812d859a) @@ -32,10 +32,10 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.IO.SoilProfile; using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects; -using Ringtoets.MacroStabilityInwards.IO.Importers; using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil; using FormsResources = Ringtoets.MacroStabilityInwards.Forms.Properties.Resources; @@ -227,7 +227,7 @@ IFileImporter importer = importInfo.CreateFileImporter(importTarget, ""); // Assert - Assert.IsInstanceOf(importer); + Assert.IsInstanceOf>(importer); mocks.VerifyAll(); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/UpdateInfos/StochasticSoilModelCollectionContextUpdateInfoTest.cs =================================================================== diff -u -r78382ec129ddc7537096860680cef36f3796700d -rbcad3e9362f5130ab5f29dad05ec17a6812d859a --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/UpdateInfos/StochasticSoilModelCollectionContextUpdateInfoTest.cs (.../StochasticSoilModelCollectionContextUpdateInfoTest.cs) (revision 78382ec129ddc7537096860680cef36f3796700d) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/UpdateInfos/StochasticSoilModelCollectionContextUpdateInfoTest.cs (.../StochasticSoilModelCollectionContextUpdateInfoTest.cs) (revision bcad3e9362f5130ab5f29dad05ec17a6812d859a) @@ -32,11 +32,11 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.IO.SoilProfile; using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects; -using Ringtoets.MacroStabilityInwards.IO.Importers; using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil; using FormsResources = Ringtoets.MacroStabilityInwards.Forms.Properties.Resources; @@ -256,7 +256,7 @@ IFileImporter importer = updateInfo.CreateFileImporter(importTarget, ""); // Assert - Assert.IsInstanceOf(importer); + Assert.IsInstanceOf>(importer); mocks.VerifyAll(); }