Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs =================================================================== diff -u -rfd19b397438b3f2298ec75b0c73390f8544bc290 -re1893c69556448f6c0054fad5ed87c14a9186f48 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision fd19b397438b3f2298ec75b0c73390f8544bc290) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision e1893c69556448f6c0054fad5ed87c14a9186f48) @@ -41,7 +41,6 @@ using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Forms.TreeNodeInfos; using Ringtoets.Common.Service; -using Ringtoets.Revetment.Data; using Ringtoets.Revetment.IO.Importers; using Ringtoets.StabilityStoneCover.Data; using Ringtoets.StabilityStoneCover.Forms; @@ -561,7 +560,7 @@ .AddRenameItem() .AddUpdateForeshoreProfileOfCalculationItem(calculation, inquiryHelper, - UpdateForeshoreProfileDerivedCalculationInput) + SynchronizeCalculationWithForeshoreProfileHelper.UpdateForeshoreProfileDerivedCalculationInput) .AddSeparator() .AddValidateCalculationItem(nodeData, Validate, @@ -578,8 +577,6 @@ .Build(); } - private static void UpdateForeshoreProfileDerivedCalculationInput(ICalculation calculation) {} - private static void Validate(StabilityStoneCoverWaveConditionsCalculationContext context) { StabilityStoneCoverWaveConditionsCalculationService.Validate(context.WrappedData, context.AssessmentSection.HydraulicBoundaryDatabase.FilePath); Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rb30ce02fbe2a89d3f608437135808b77ed734787 -re1893c69556448f6c0054fad5ed87c14a9186f48 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision b30ce02fbe2a89d3f608437135808b77ed734787) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision e1893c69556448f6c0054fad5ed87c14a9186f48) @@ -728,6 +728,59 @@ } [Test] + public void GivenCalculationWithForeshoreProfileSet_WhenUpdatingForeshoreProfileFromContextMenu_ThenCalculationUpdatedAndUpdateObserver() + { + // Given + var calculationObserver = mocks.StrictMock(); + var calculationInputObserver = mocks.StrictMock(); + calculationInputObserver.Expect(o => o.UpdateObserver()); + + var assessmentSectionStub = mocks.Stub(); + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + + var calculation = new StabilityStoneCoverWaveConditionsCalculation + { + InputParameters = + { + ForeshoreProfile = new TestForeshoreProfile(true) + } + }; + calculation.InputParameters.UseBreakWater = false; + var nodeData = new StabilityStoneCoverWaveConditionsCalculationContext(calculation, + failureMechanism, + assessmentSectionStub); + + calculation.Attach(calculationObserver); + calculation.InputParameters.Attach(calculationInputObserver); + + using (var treeViewControl = new TreeViewControl()) + { + var gui = mocks.Stub(); + gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); + mocks.ReplayAll(); + + plugin.Gui = gui; + + using (ContextMenuStrip contextMenuStrip = info.ContextMenuStrip(nodeData, null, treeViewControl)) + { + // Precondition + TestHelper.AssertContextMenuStripContainsItem(contextMenuStrip, + contextMenuUpdateForeshoreProfileIndex, + "&Bijwerken voorlandprofiel...", + "Berekening bijwerken waar een voorlandprofiel geselecteerd is.", + RingtoetsCommonFormsResources.UpdateItemIcon); + + // When + contextMenuStrip.Items[contextMenuUpdateForeshoreProfileIndex].PerformClick(); + + // Then + Assert.IsTrue(calculation.InputParameters.UseBreakWater); + } + } + } + + [Test] [TestCase(false)] [TestCase(true)] public void GivenCalculation_WhenValidating_ThenCalculationValidated(bool validCalculation)