Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs =================================================================== diff -u -rf376e95ad2333bf216fafd39e1568f6cb9782158 -r7172df944db7fd2d59d68a7a8def96110a44ed9b --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs) (revision f376e95ad2333bf216fafd39e1568f6cb9782158) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs) (revision 7172df944db7fd2d59d68a7a8def96110a44ed9b) @@ -283,10 +283,14 @@ locations.ForEach(loc => loc.DesignWaterLevelOutput = null); + int refreshed = 0; + dataGridView.Invalidated += (sender, args) => refreshed++; + // Call locations.NotifyObservers(); // Assert + Assert.AreEqual(1, refreshed); Assert.AreEqual(3, rows.Count); Assert.AreEqual("-", rows[0].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); Assert.AreEqual("-", rows[1].Cells[locationDesignWaterlevelColumnIndex].FormattedValue); Index: Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataUpdateHelper.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataUpdateHelper.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataUpdateHelper.cs (revision 7172df944db7fd2d59d68a7a8def96110a44ed9b) @@ -0,0 +1,64 @@ +// Copyright (C) Stichting Deltares 2016. 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.IO; +using Core.Common.Base.Service; +using Core.Common.Utils.IO; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Integration.Data; +using Ringtoets.Piping.Data; +using Ringtoets.Piping.IO.Importers; +using Ringtoets.Piping.Plugin.FileImporter; + +namespace Ringtoets.Integration.TestUtils +{ + /// + /// Helper methods related to importing data for integration tests. + /// + public static class DataUpdateHelper + { + /// + /// Imports the data for the + /// of the given and updates existing data based upon the imported + /// data. + /// + /// The to import on. + /// When data from is used, + /// this will remove 1 soil models, 1 stochastic soil profile and update the probability of another + /// stochastic soil profile. + public static void UpdatePipingStochasticSoilModels(AssessmentSection assessmentSection) + { + using (var embeddedResourceFileWriter = new EmbeddedResourceFileWriter(typeof(DataUpdateHelper).Assembly, + true, + "DR6_updated.soil")) + { + string filePath = Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "DR6_updated.soil"); + var activity = new FileImportActivity(new StochasticSoilModelImporter( + assessmentSection.PipingFailureMechanism.StochasticSoilModels, + filePath, + new StochasticSoilModelUpdateDataStrategy(assessmentSection.PipingFailureMechanism)), + "StochasticSoilModelUpdater"); + activity.Run(); + activity.Finish(); + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/EmbeddedResources/DR6_updated.soil =================================================================== diff -u Binary files differ Index: Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/Ringtoets.Integration.TestUtils.csproj =================================================================== diff -u -rf35a1bdec32700c5cb0027d714c8a51dfc118e0d -r7172df944db7fd2d59d68a7a8def96110a44ed9b --- Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/Ringtoets.Integration.TestUtils.csproj (.../Ringtoets.Integration.TestUtils.csproj) (revision f35a1bdec32700c5cb0027d714c8a51dfc118e0d) +++ Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/Ringtoets.Integration.TestUtils.csproj (.../Ringtoets.Integration.TestUtils.csproj) (revision 7172df944db7fd2d59d68a7a8def96110a44ed9b) @@ -52,6 +52,7 @@ Properties\GlobalAssembly.cs + @@ -80,6 +81,7 @@ + Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs =================================================================== diff -u -rfde9fb747c4afe9b3c32a80e1efeef24b535decd -r7172df944db7fd2d59d68a7a8def96110a44ed9b --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision fde9fb747c4afe9b3c32a80e1efeef24b535decd) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision 7172df944db7fd2d59d68a7a8def96110a44ed9b) @@ -47,6 +47,7 @@ private RingtoetsPipingSurfaceLine surfaceLine; private RoundedDouble assessmentLevel; private bool useAssessmentLevelManualInput; + private StochasticSoilProfile stochasticSoilProfile; /// /// Initializes a new instance of the class. @@ -183,7 +184,17 @@ /// /// Gets or sets the profile which contains a 1 dimensional definition of soil layers with properties. /// - public StochasticSoilProfile StochasticSoilProfile { get; set; } + public StochasticSoilProfile StochasticSoilProfile + { + get + { + return stochasticSoilProfile; + } + set + { + stochasticSoilProfile = value; + } + } /// /// Gets or sets the hydraulic boundary location from which to use the assessment level. Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfile.cs =================================================================== diff -u -r29acdef1f06e3be94d7fd8a94731e391b5d97ae8 -r7172df944db7fd2d59d68a7a8def96110a44ed9b --- Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfile.cs (.../StochasticSoilProfile.cs) (revision 29acdef1f06e3be94d7fd8a94731e391b5d97ae8) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilProfile.cs (.../StochasticSoilProfile.cs) (revision 7172df944db7fd2d59d68a7a8def96110a44ed9b) @@ -31,7 +31,7 @@ /// /// This class couples a SoilProfile to a probability of occurrence. /// - public class StochasticSoilProfile + public class StochasticSoilProfile : Observable { private double probability; Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs =================================================================== diff -u -r37fc59cc0f3becb92e14b8263bd8e9fc71aa0e79 -r7172df944db7fd2d59d68a7a8def96110a44ed9b --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision 37fc59cc0f3becb92e14b8263bd8e9fc71aa0e79) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision 7172df944db7fd2d59d68a7a8def96110a44ed9b) @@ -58,6 +58,7 @@ private readonly RecursiveObserver pipingCalculationObserver; private readonly Observer pipingFailureMechanismObserver; private readonly Observer pipingStochasticSoilModelsObserver; + private readonly RecursiveObserver stochasticSoilProfileObserver; private IAssessmentSection assessmentSection; private CalculationGroup calculationGroup; private PipingFailureMechanism pipingFailureMechanism; @@ -75,13 +76,15 @@ InitializeDataGridView(); InitializeListBox(); - pipingStochasticSoilModelsObserver = new Observer(OnStochasticSoilModelsUpdate); pipingFailureMechanismObserver = new Observer(OnPipingFailureMechanismUpdate); assessmentSectionObserver = new Observer(UpdateSelectableHydraulicBoundaryLocationsColumn); // The concat is needed to observe the input of calculations in child groups. pipingInputObserver = new RecursiveObserver(UpdateDataGridViewDataSource, pcg => pcg.Children.Concat(pcg.Children.OfType().Select(pc => pc.InputParameters))); pipingCalculationGroupObserver = new RecursiveObserver(UpdateDataGridViewDataSource, pcg => pcg.Children); pipingCalculationObserver = new RecursiveObserver(dataGridViewControl.RefreshDataGridView, pcg => pcg.Children); + + pipingStochasticSoilModelsObserver = new Observer(OnStochasticSoilModelsUpdate); + stochasticSoilProfileObserver = new RecursiveObserver(dataGridViewControl.RefreshDataGridView, ssmc => ssmc.SelectMany(ssm => ssm.StochasticSoilProfiles)); } /// @@ -98,6 +101,7 @@ pipingFailureMechanism = value; pipingStochasticSoilModelsObserver.Observable = pipingFailureMechanism?.StochasticSoilModels; pipingFailureMechanismObserver.Observable = pipingFailureMechanism; + stochasticSoilProfileObserver.Observable = pipingFailureMechanism?.StochasticSoilModels; UpdateStochasticSoilModelColumn(); UpdateStochasticSoilProfileColumn(); Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/StochasticSoilModelUpdateDataStrategy.cs =================================================================== diff -u -raae2ecaacbb094fe66d6a54d6ac4b1e6780b0864 -r7172df944db7fd2d59d68a7a8def96110a44ed9b --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/StochasticSoilModelUpdateDataStrategy.cs (.../StochasticSoilModelUpdateDataStrategy.cs) (revision aae2ecaacbb094fe66d6a54d6ac4b1e6780b0864) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/StochasticSoilModelUpdateDataStrategy.cs (.../StochasticSoilModelUpdateDataStrategy.cs) (revision 7172df944db7fd2d59d68a7a8def96110a44ed9b) @@ -121,6 +121,7 @@ { affectedObjects.AddRange(PipingDataSynchronizationService.ClearStochasticSoilProfileDependentData(failureMechanism, updatedProfile)); } + affectedObjects.Add(updatedProfile); } return affectedObjects; } Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs =================================================================== diff -u -r29acdef1f06e3be94d7fd8a94731e391b5d97ae8 -r7172df944db7fd2d59d68a7a8def96110a44ed9b --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 29acdef1f06e3be94d7fd8a94731e391b5d97ae8) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilProfileTest.cs (.../StochasticSoilProfileTest.cs) (revision 7172df944db7fd2d59d68a7a8def96110a44ed9b) @@ -21,6 +21,7 @@ using System; using System.Drawing; +using Core.Common.Base; using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Piping.KernelWrapper.TestUtil; @@ -42,7 +43,7 @@ var stochasticSoilProfileProbability = new StochasticSoilProfile(probability, soilProfileType, soilProfileId); // Assert - Assert.IsInstanceOf(stochasticSoilProfileProbability); + Assert.IsInstanceOf(stochasticSoilProfileProbability); Assert.AreEqual(probability, stochasticSoilProfileProbability.Probability); Assert.AreEqual(soilProfileType, stochasticSoilProfileProbability.SoilProfileType); Assert.AreEqual(soilProfileId, stochasticSoilProfileProbability.SoilProfileId); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingCalculationsViewTest.cs =================================================================== diff -u -r37fc59cc0f3becb92e14b8263bd8e9fc71aa0e79 -r7172df944db7fd2d59d68a7a8def96110a44ed9b --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingCalculationsViewTest.cs (.../PipingCalculationsViewTest.cs) (revision 37fc59cc0f3becb92e14b8263bd8e9fc71aa0e79) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingCalculationsViewTest.cs (.../PipingCalculationsViewTest.cs) (revision 7172df944db7fd2d59d68a7a8def96110a44ed9b) @@ -1070,10 +1070,10 @@ RoundedDouble value = (RoundedDouble) newValue; var handler = new CalculationInputSetPropertyValueAfterConfirmationParameterTester(new Observable[] - { - calculation.InputParameters, - calculation - }); + { + calculation.InputParameters, + calculation + }); using (PipingCalculationsView pipingCalculationView = ShowFullyConfiguredPipingCalculationsView( assessmentSection, failureMechanism, calculationGroup, handler)) @@ -1116,10 +1116,10 @@ PipingCalculationScenario calculation = (PipingCalculationScenario) calculationGroup.Children.First(); var handler = new CalculationInputSetPropertyValueAfterConfirmationParameterTester(new Observable[] - { - calculation.InputParameters, - calculation - }); + { + calculation.InputParameters, + calculation + }); using (PipingCalculationsView pipingCalculationView = ShowFullyConfiguredPipingCalculationsView( assessmentSection, failureMechanism, calculationGroup, handler)) @@ -1317,6 +1317,51 @@ mocks.VerifyAll(); } + [Test] + public void GivenPipingCalculationWithStochasticSoilProfile_WhenProbabilityChangesAndNotified_ThenNewProbabilityVisible() + { + // Given + MockRepository mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + var handler = mocks.Stub(); + mocks.ReplayAll(); + + using (PipingCalculationsView pipingCalculationView = ShowFullyConfiguredPipingCalculationsView( + assessmentSection, handler)) + { + var data = (CalculationGroup) pipingCalculationView.Data; + var pipingCalculation = (PipingCalculationScenario) data.Children[1]; + + var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; + + int refreshed = 0; + + // Precondition + var currentCell = (DataGridViewTextBoxCell) dataGridView.Rows[1].Cells[stochasticSoilProfilesProbabilityColumnIndex]; + Assert.AreEqual("30", currentCell.FormattedValue); + + StochasticSoilProfile stochasticSoilProfileToChange = pipingCalculation.InputParameters.StochasticSoilProfile; + var updatedProfile = new StochasticSoilProfile( + 0.5, + stochasticSoilProfileToChange.SoilProfileType, + stochasticSoilProfileToChange.SoilProfileId) + { + SoilProfile = stochasticSoilProfileToChange.SoilProfile + }; + dataGridView.Invalidated += (sender, args) => refreshed++; + + // When + stochasticSoilProfileToChange.Update(updatedProfile); + stochasticSoilProfileToChange.NotifyObservers(); + + // Then + Assert.AreEqual(1, refreshed); + var cell = (DataGridViewTextBoxCell) dataGridView.Rows[1].Cells[stochasticSoilProfilesProbabilityColumnIndex]; + Assert.AreEqual("50", cell.FormattedValue); + } + mocks.VerifyAll(); + } + private PipingCalculationsView ShowFullyConfiguredPipingCalculationsView( IAssessmentSection assessmentSection, IObservablePropertyChangeHandler handler) Index: Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/PipingCalculationsViewIntegrationTest.cs =================================================================== diff -u -r277048d204ab4cfad4aa5de4d57ef38b56642c25 -r7172df944db7fd2d59d68a7a8def96110a44ed9b --- Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/PipingCalculationsViewIntegrationTest.cs (.../PipingCalculationsViewIntegrationTest.cs) (revision 277048d204ab4cfad4aa5de4d57ef38b56642c25) +++ Ringtoets/Piping/test/Ringtoets.Piping.Integration.Test/PipingCalculationsViewIntegrationTest.cs (.../PipingCalculationsViewIntegrationTest.cs) (revision 7172df944db7fd2d59d68a7a8def96110a44ed9b) @@ -42,6 +42,7 @@ private const int nameColumnIndex = 0; private const int stochasticSoilModelsColumnIndex = 1; private const int stochasticSoilProfilesColumnIndex = 2; + private const int stochasticSoilProfilesProbabilityColumnIndex = 3; private const int hydraulicBoundaryLocationsColumnIndex = 4; private const int exitPointLColumnIndex = 8; @@ -98,7 +99,8 @@ // Import soil models and profiles and ensure the corresponding combobox items are updated DataImportHelper.ImportPipingStochasticSoilModels(assessmentSection); - pipingCalculation1.InputParameters.StochasticSoilModel = assessmentSection.PipingFailureMechanism.StochasticSoilModels.First(sl => sl.Name == "PK001_0001_Piping"); + StochasticSoilModelCollection stochasticSoilModelCollection = assessmentSection.PipingFailureMechanism.StochasticSoilModels; + pipingCalculation1.InputParameters.StochasticSoilModel = stochasticSoilModelCollection.First(sl => sl.Name == "PK001_0001_Piping"); Assert.AreEqual(1, ((DataGridViewComboBoxCell) dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex]).Items.Count); Assert.AreEqual("PK001_0001_Piping", dataGridView.Rows[0].Cells[stochasticSoilModelsColumnIndex].FormattedValue); Assert.AreEqual(1, ((DataGridViewComboBoxCell) dataGridView.Rows[0].Cells[stochasticSoilProfilesColumnIndex]).Items.Count); @@ -138,6 +140,73 @@ pipingCalculation2.InputParameters.ExitPointL = (RoundedDouble) 111.11; pipingCalculation2.InputParameters.NotifyObservers(); Assert.AreEqual(111.11.ToString(CultureInfo.CurrentCulture), dataGridView.Rows[1].Cells[exitPointLColumnIndex].FormattedValue); + + // Add another calculation and assign all soil models + var pipingCalculation4 = new PipingCalculationScenario(new GeneralPipingInput()); + assessmentSection.PipingFailureMechanism.CalculationsGroup.Children.Add(pipingCalculation4); + assessmentSection.PipingFailureMechanism.CalculationsGroup.NotifyObservers(); + pipingCalculation4.InputParameters.SurfaceLine = assessmentSection.PipingFailureMechanism.SurfaceLines.First(sl => sl.Name == "PK001_0001"); + pipingCalculation4.InputParameters.NotifyObservers(); + Assert.AreEqual(4, dataGridView.Rows.Count); + + listBox.SelectedItem = assessmentSection.PipingFailureMechanism.Sections.First(s => s.Name == "6-3_22"); + pipingCalculation1.InputParameters.StochasticSoilModel = stochasticSoilModelCollection[0]; + pipingCalculation1.InputParameters.StochasticSoilProfile = stochasticSoilModelCollection[0].StochasticSoilProfiles[0]; + pipingCalculation1.InputParameters.NotifyObservers(); + Assert.AreEqual("PK001_0001_Piping", 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); + + listBox.SelectedItem = assessmentSection.PipingFailureMechanism.Sections.First(s => s.Name == "6-3_19"); + pipingCalculation2.InputParameters.SurfaceLine = assessmentSection.PipingFailureMechanism.SurfaceLines.First(sl => sl.Name == "PK001_0002"); + pipingCalculation2.InputParameters.StochasticSoilModel = stochasticSoilModelCollection[1]; + pipingCalculation2.InputParameters.StochasticSoilProfile = stochasticSoilModelCollection[1].StochasticSoilProfiles[0]; + pipingCalculation2.InputParameters.NotifyObservers(); + Assert.AreEqual("PK001_0002_Piping", 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.PipingFailureMechanism.Sections.First(s => s.Name == "6-3_16"); + pipingCalculation3.InputParameters.SurfaceLine = assessmentSection.PipingFailureMechanism.SurfaceLines.First(sl => sl.Name == "PK001_0003"); + pipingCalculation3.InputParameters.StochasticSoilModel = stochasticSoilModelCollection[2]; + pipingCalculation3.InputParameters.StochasticSoilProfile = stochasticSoilModelCollection[2].StochasticSoilProfiles[0]; + pipingCalculation3.InputParameters.NotifyObservers(); + Assert.AreEqual("PK001_0003_Piping", 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.PipingFailureMechanism.Sections.First(s => s.Name == "6-3_8"); + pipingCalculation4.InputParameters.SurfaceLine = assessmentSection.PipingFailureMechanism.SurfaceLines.First(sl => sl.Name == "PK001_0004"); + pipingCalculation4.InputParameters.StochasticSoilModel = stochasticSoilModelCollection[3]; + pipingCalculation4.InputParameters.StochasticSoilProfile = stochasticSoilModelCollection[3].StochasticSoilProfiles[0]; + pipingCalculation4.InputParameters.NotifyObservers(); + Assert.AreEqual("PK001_0004_Piping", 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.UpdatePipingStochasticSoilModels(assessmentSection); + + listBox.SelectedItem = assessmentSection.PipingFailureMechanism.Sections.First(s => s.Name == "6-3_22"); + Assert.AreEqual("PK001_0001_Piping", 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); + + listBox.SelectedItem = assessmentSection.PipingFailureMechanism.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); + + listBox.SelectedItem = assessmentSection.PipingFailureMechanism.Sections.First(s => s.Name == "6-3_16"); + Assert.AreEqual("PK001_0003_Piping", 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.PipingFailureMechanism.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); + } } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/StochasticSoilModelUpdateDataStrategyTest.cs =================================================================== diff -u -raae2ecaacbb094fe66d6a54d6ac4b1e6780b0864 -r7172df944db7fd2d59d68a7a8def96110a44ed9b --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/StochasticSoilModelUpdateDataStrategyTest.cs (.../StochasticSoilModelUpdateDataStrategyTest.cs) (revision aae2ecaacbb094fe66d6a54d6ac4b1e6780b0864) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/StochasticSoilModelUpdateDataStrategyTest.cs (.../StochasticSoilModelUpdateDataStrategyTest.cs) (revision 7172df944db7fd2d59d68a7a8def96110a44ed9b) @@ -408,7 +408,8 @@ { firstSoilModel, calculationWithUpdatedProfile, - calculationWithUpdatedProfile.InputParameters + calculationWithUpdatedProfile.InputParameters, + calculationWithUpdatedProfile.InputParameters.StochasticSoilProfile }, affectedObjects); } @@ -440,8 +441,12 @@ Assert.IsFalse(calculation.HasOutput); Assert.IsNull(calculation.InputParameters.StochasticSoilModel); Assert.IsNull(calculation.InputParameters.StochasticSoilProfile); - CollectionAssert.Contains(affectedObjects, calculation); - CollectionAssert.Contains(affectedObjects, calculation.InputParameters); + CollectionAssert.AreEquivalent(new IObservable[] + { + targetCollection, + calculation, + calculation.InputParameters + }, affectedObjects); } ///