Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rfaa45d14b96d0433ec561a39635ad6285b1ad5e3 -r69edbc24f85afa7054f2d3c1e68d06b502f5a2ae --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs (.../ClosingStructuresCalculationContextTreeNodeInfoTest.cs) (revision faa45d14b96d0433ec561a39635ad6285b1ad5e3) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresCalculationContextTreeNodeInfoTest.cs (.../ClosingStructuresCalculationContextTreeNodeInfoTest.cs) (revision 69edbc24f85afa7054f2d3c1e68d06b502f5a2ae) @@ -873,6 +873,58 @@ } [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 TestClosingStructuresFailureMechanism(); + + var calculation = new StructuresCalculation + { + InputParameters = + { + ForeshoreProfile = new TestForeshoreProfile(true) + } + }; + calculation.InputParameters.UseBreakWater = false; + var nodeData = new ClosingStructuresCalculationContext(calculation, + failureMechanism, + assessmentSectionStub); + + calculation.Attach(calculationObserver); + calculation.InputParameters.Attach(calculationInputObserver); + + using (var treeViewControl = new TreeViewControl()) + { + 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] public void GivenSuccessfulCalculation_WhenCalculatingFromContextMenu_ThenOutputSetLogMessagesAddedAndUpdateObserver() { // Given Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rfaa45d14b96d0433ec561a39635ad6285b1ad5e3 -r69edbc24f85afa7054f2d3c1e68d06b502f5a2ae --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision faa45d14b96d0433ec561a39635ad6285b1ad5e3) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 69edbc24f85afa7054f2d3c1e68d06b502f5a2ae) @@ -1117,6 +1117,62 @@ } [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 GrassCoverErosionOutwardsFailureMechanism + { + Contribution = 5 + }; + + var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation + { + InputParameters = + { + ForeshoreProfile = new TestForeshoreProfile(true) + } + }; + calculation.InputParameters.UseBreakWater = false; + var nodeData = new GrassCoverErosionOutwardsWaveConditionsCalculationContext(calculation, + failureMechanism, + assessmentSectionStub); + + calculation.Attach(calculationObserver); + calculation.InputParameters.Attach(calculationInputObserver); + + using (var treeViewControl = new TreeViewControl()) + { + var guiStub = mocks.Stub(); + guiStub.Stub(g => g.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + guiStub.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); + mocks.ReplayAll(); + + plugin.Gui = guiStub; + + 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] public void GivenValidCalculation_WhenCalculating_ThenCalculationReturnsResult() { // Given Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rfaa45d14b96d0433ec561a39635ad6285b1ad5e3 -r69edbc24f85afa7054f2d3c1e68d06b502f5a2ae --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision faa45d14b96d0433ec561a39635ad6285b1ad5e3) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision 69edbc24f85afa7054f2d3c1e68d06b502f5a2ae) @@ -970,7 +970,7 @@ { // Setup var assessmentSectionStub = mocks.Stub(); - var failureMechanism = new TestHeightStructuresFailureMechanism(); + var failureMechanism = new HeightStructuresFailureMechanism(); var calculation = new StructuresCalculation { InputParameters = @@ -1006,6 +1006,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 HeightStructuresFailureMechanism(); + + var calculation = new StructuresCalculation + { + InputParameters = + { + ForeshoreProfile = new TestForeshoreProfile(true) + } + }; + calculation.InputParameters.UseBreakWater = false; + var nodeData = new HeightStructuresCalculationContext(calculation, + failureMechanism, + assessmentSectionStub); + + calculation.Attach(calculationObserver); + calculation.InputParameters.Attach(calculationInputObserver); + + using (var treeViewControl = new TreeViewControl()) + { + var guiStub = mocks.Stub(); + guiStub.Stub(g => g.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + guiStub.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); + mocks.ReplayAll(); + + plugin.Gui = guiStub; + + 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] public void GivenCalculationThatSucceeds_WhenCalculatingFromContextMenu_ThenOutputSetLogMessagesAddedAndUpdateObserver() { // Given Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -re1893c69556448f6c0054fad5ed87c14a9186f48 -r69edbc24f85afa7054f2d3c1e68d06b502f5a2ae --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision e1893c69556448f6c0054fad5ed87c14a9186f48) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 69edbc24f85afa7054f2d3c1e68d06b502f5a2ae) @@ -755,12 +755,12 @@ 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()); + var guiStub = mocks.Stub(); + guiStub.Stub(g => g.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + guiStub.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); mocks.ReplayAll(); - plugin.Gui = gui; + plugin.Gui = guiStub; using (ContextMenuStrip contextMenuStrip = info.ContextMenuStrip(nodeData, null, treeViewControl)) { Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rfaa45d14b96d0433ec561a39635ad6285b1ad5e3 -r69edbc24f85afa7054f2d3c1e68d06b502f5a2ae --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision faa45d14b96d0433ec561a39635ad6285b1ad5e3) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 69edbc24f85afa7054f2d3c1e68d06b502f5a2ae) @@ -986,6 +986,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 WaveImpactAsphaltCoverFailureMechanism(); + + var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation + { + InputParameters = + { + ForeshoreProfile = new TestForeshoreProfile(true) + } + }; + calculation.InputParameters.UseBreakWater = false; + var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation, + failureMechanism, + assessmentSectionStub); + + calculation.Attach(calculationObserver); + calculation.InputParameters.Attach(calculationInputObserver); + + using (var treeViewControl = new TreeViewControl()) + { + var guiStub = mocks.Stub(); + guiStub.Stub(g => g.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + guiStub.Stub(cmp => cmp.MainWindow).Return(mocks.Stub()); + mocks.ReplayAll(); + + plugin.Gui = guiStub; + + 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] public void GivenValidCalculation_WhenCalculating_ThenCalculationReturnsResult() { // Given