Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rff68006e7e8f9abbb1e13617d0c99318ec07c400 -rf34442707f3ce22e015d08369e39d4830b856362 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision ff68006e7e8f9abbb1e13617d0c99318ec07c400) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision f34442707f3ce22e015d08369e39d4830b856362) @@ -686,7 +686,7 @@ } [Test] - public void ContextMenuStrip_WithForeshoreProfileAndChanges_ContextMenuItemUpdateForeshoreProfileEnabled() + public void ContextMenuStrip_CalculationWithForeshoreProfileAndInputOutOfSync_ContextMenuItemUpdateForeshoreProfileEnabledAndToolTipSet() { // Setup var assessmentSectionStub = mocks.Stub(); @@ -698,7 +698,6 @@ ForeshoreProfile = new TestForeshoreProfile() } }; - calculation.InputParameters.UseBreakWater = true; var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation, failureMechanism, assessmentSectionStub); @@ -712,6 +711,8 @@ plugin.Gui = gui; + calculation.InputParameters.UseBreakWater = true; + // Call using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { @@ -726,6 +727,60 @@ } [Test] + public void GivenCalculationWithoutOutputAndWithInputOutOfSync_WhenUpdateForeshoreProfileClicked_ThenNoInquiryAndCalculationUpdatedAndInputObserverNotified() + { + // 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) + } + }; + 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; + + calculation.InputParameters.UseBreakWater = false; + + using (ContextMenuStrip contextMenuStrip = info.ContextMenuStrip(nodeData, null, treeViewControl)) + { + // Precondition + TestHelper.AssertContextMenuStripContainsItem(contextMenuStrip, + contextMenuUpdateForeshoreProfileIndex, + "&Bijwerken voorlandprofiel...", + "Berekening bijwerken met het voorlandprofiel.", + RingtoetsCommonFormsResources.UpdateItemIcon); + + // When + contextMenuStrip.Items[contextMenuUpdateForeshoreProfileIndex].PerformClick(); + + // Then + Assert.IsTrue(calculation.InputParameters.UseBreakWater); + } + } + } + + [Test] [TestCase(true)] [TestCase(false)] public void GivenCalculation_WhenValidating_ThenCalculationValidated(bool validCalculation) @@ -986,59 +1041,6 @@ } [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 met het voorlandprofiel.", - RingtoetsCommonFormsResources.UpdateItemIcon); - - // When - contextMenuStrip.Items[contextMenuUpdateForeshoreProfileIndex].PerformClick(); - - // Then - Assert.IsTrue(calculation.InputParameters.UseBreakWater); - } - } - } - - [Test] public void GivenValidCalculation_WhenCalculating_ThenCalculationReturnsResult() { // Given