Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r5a6d329435609e061bf207fc4c7e29cbd5a732e2 -re7eb9aa4f8a0657c1537abbc0b9d6a53f74e87d0 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs (.../ClosingStructuresCalculationContextTreeNodeInfoTest.cs) (revision 5a6d329435609e061bf207fc4c7e29cbd5a732e2) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs (.../ClosingStructuresCalculationContextTreeNodeInfoTest.cs) (revision e7eb9aa4f8a0657c1537abbc0b9d6a53f74e87d0) @@ -834,6 +834,44 @@ } [Test] + public void ContextMenuStrip_WithForeshoreProfile_ContextMenuItemUpdateForeshoreProfileEnabled() + { + // Setup + var assessmentSectionStub = mocks.Stub(); + var failureMechanism = new TestClosingStructuresFailureMechanism(); + var calculation = new StructuresCalculation + { + InputParameters = + { + ForeshoreProfile = new TestForeshoreProfile() + } + }; + var nodeData = new ClosingStructuresCalculationContext(calculation, + failureMechanism, + assessmentSectionStub); + + using (var treeViewControl = new TreeViewControl()) + { + gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) + { + // Assert + TestHelper.AssertContextMenuStripContainsItem(menu, + contextMenuUpdateForeshoreProfileIndex, + "&Bijwerken voorlandprofiel...", + "Berekening bijwerken waar een voorlandprofiel geselecteerd is.", + RingtoetsCommonFormsResources.UpdateItemIcon); + } + } + } + + [Test] public void GivenSuccessfulCalculation_WhenCalculatingFromContextMenu_ThenOutputSetLogMessagesAddedAndUpdateObserver() { // Given Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r961c0bdb44b8058e95d8339b1a3bdc826e4ceb9b -re7eb9aa4f8a0657c1537abbc0b9d6a53f74e87d0 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 961c0bdb44b8058e95d8339b1a3bdc826e4ceb9b) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision e7eb9aa4f8a0657c1537abbc0b9d6a53f74e87d0) @@ -761,6 +761,48 @@ } [Test] + public void ContextMenuStrip_WithForeshoreProfile_ContextMenuItemUpdateForeshoreProfileEnabled() + { + // Setup + var assessmentSectionStub = mocks.Stub(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism + { + Contribution = 5 + }; + var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation + { + InputParameters = + { + ForeshoreProfile = new TestForeshoreProfile() + } + }; + var nodeData = new GrassCoverErosionOutwardsWaveConditionsCalculationContext(calculation, + failureMechanism, + assessmentSectionStub); + + using (var treeViewControl = new TreeViewControl()) + { + var gui = mocks.Stub(); + gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) + { + // Assert + TestHelper.AssertContextMenuStripContainsItem(menu, + contextMenuUpdateForeshoreProfileIndex, + "&Bijwerken voorlandprofiel...", + "Berekening bijwerken waar een voorlandprofiel geselecteerd is.", + RingtoetsCommonFormsResources.UpdateItemIcon); + } + } + } + + [Test] [TestCase(true)] [TestCase(false)] public void GivenCalculation_WhenValidating_ThenCalculationValidated(bool validCalculation) Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r5a6d329435609e061bf207fc4c7e29cbd5a732e2 -re7eb9aa4f8a0657c1537abbc0b9d6a53f74e87d0 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision 5a6d329435609e061bf207fc4c7e29cbd5a732e2) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision e7eb9aa4f8a0657c1537abbc0b9d6a53f74e87d0) @@ -966,6 +966,45 @@ } [Test] + public void ContextMenuStrip_WithForeshoreProfile_ContextMenuItemUpdateForeshoreProfileEnabled() + { + // Setup + var assessmentSectionStub = mocks.Stub(); + var failureMechanism = new TestHeightStructuresFailureMechanism(); + var calculation = new StructuresCalculation + { + InputParameters = + { + ForeshoreProfile = new TestForeshoreProfile() + } + }; + var nodeData = new HeightStructuresCalculationContext(calculation, + failureMechanism, + assessmentSectionStub); + + using (var treeViewControl = new TreeViewControl()) + { + var gui = mocks.Stub(); + gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) + { + // Assert + TestHelper.AssertContextMenuStripContainsItem(menu, + contextMenuUpdateForeshoreProfileIndex, + "&Bijwerken voorlandprofiel...", + "Berekening bijwerken waar een voorlandprofiel geselecteerd is.", + RingtoetsCommonFormsResources.UpdateItemIcon); + } + } + } + + [Test] public void GivenCalculationThatSucceeds_WhenCalculatingFromContextMenu_ThenOutputSetLogMessagesAddedAndUpdateObserver() { // Given Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r1f53a54d4b93ca002ae0ec0905c0dab16fa7ae6a -re7eb9aa4f8a0657c1537abbc0b9d6a53f74e87d0 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs (.../StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs) (revision 1f53a54d4b93ca002ae0ec0905c0dab16fa7ae6a) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/TreeNodeInfos/StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs (.../StabilityPointStructuresCalculationContextTreeNodeInfoTest.cs) (revision e7eb9aa4f8a0657c1537abbc0b9d6a53f74e87d0) @@ -222,16 +222,16 @@ // Setup string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); - var assessmentSection = mocks.Stub(); - assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + var assessmentSectionStub = mocks.Stub(); + assessmentSectionStub.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase { FilePath = validFilePath, Version = "random" }; var failureMechanism = new TestStabilityPointStructuresFailureMechanism(); var calculation = new StructuresCalculation(); - var nodeData = new StabilityPointStructuresCalculationContext(calculation, failureMechanism, assessmentSection); + var nodeData = new StabilityPointStructuresCalculationContext(calculation, failureMechanism, assessmentSectionStub); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); using (var treeViewControl = new TreeViewControl()) @@ -244,7 +244,7 @@ plugin.Gui = gui; // Call - using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, assessmentSection, treeViewControl)) + using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, assessmentSectionStub, treeViewControl)) { // Assert Assert.AreEqual(15, menu.Items.Count); @@ -442,6 +442,45 @@ } [Test] + public void ContextMenuStrip_WithForeshoreProfile_ContextMenuItemUpdateForeshoreProfileEnabled() + { + // Setup + var assessmentSectionStub = mocks.Stub(); + var failureMechanism = new TestStabilityPointStructuresFailureMechanism(); + var calculation = new StructuresCalculation + { + InputParameters = + { + ForeshoreProfile = new TestForeshoreProfile() + } + }; + var nodeData = new StabilityPointStructuresCalculationContext(calculation, + failureMechanism, + assessmentSectionStub); + + using (var treeViewControl = new TreeViewControl()) + { + var gui = mocks.Stub(); + gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) + { + // Assert + TestHelper.AssertContextMenuStripContainsItem(menu, + contextMenuUpdateForeshoreProfileIndex, + "&Bijwerken voorlandprofiel...", + "Berekening bijwerken waar een voorlandprofiel geselecteerd is.", + RingtoetsCommonFormsResources.UpdateItemIcon); + } + } + } + + [Test] public void GivenCalculationThatSucceeds_WhenCalculatingFromContextMenu_ThenOutputSetLogMessagesAddedAndUpdateObserver() { // Given Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -ra8b7e56d629ab7530987136097a6686dc12b0861 -re7eb9aa4f8a0657c1537abbc0b9d6a53f74e87d0 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision a8b7e56d629ab7530987136097a6686dc12b0861) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision e7eb9aa4f8a0657c1537abbc0b9d6a53f74e87d0) @@ -686,6 +686,45 @@ } [Test] + public void ContextMenuStrip_WithForeshoreProfile_ContextMenuItemUpdateForeshoreProfileEnabled() + { + // Setup + var assessmentSectionStub = mocks.Stub(); + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation + { + InputParameters = + { + ForeshoreProfile = new TestForeshoreProfile() + } + }; + var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation, + failureMechanism, + assessmentSectionStub); + + using (var treeViewControl = new TreeViewControl()) + { + var gui = mocks.Stub(); + gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) + { + // Assert + TestHelper.AssertContextMenuStripContainsItem(menu, + contextMenuUpdateForeshoreProfileIndex, + "&Bijwerken voorlandprofiel...", + "Berekening bijwerken waar een voorlandprofiel geselecteerd is.", + RingtoetsCommonFormsResources.UpdateItemIcon); + } + } + } + + [Test] [TestCase(true)] [TestCase(false)] public void GivenCalculation_WhenValidating_ThenCalculationValidated(bool validCalculation)