Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r83af2943ba9181ef2f329f7a102dd8e8326f6b9c -rffd18d54d6f2d3b12d414d5f5234e6f598c39962 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision 83af2943ba9181ef2f329f7a102dd8e8326f6b9c) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision ffd18d54d6f2d3b12d414d5f5234e6f598c39962) @@ -630,5 +630,106 @@ // Assert CollectionAssert.DoesNotContain(failureMechanism.WaveConditionsCalculationGroup.Children, group); } + + [Test] + public void GivenCalculationWithoutOutput_ThenClearOutputItemDisabled() + { + // Given + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + var assessmentSection = mocks.Stub(); + + var context = new StabilityStoneCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup, + failureMechanism, + assessmentSection); + + using (var treeViewControl = new TreeViewControl()) + { + var appFeatureCommandHandler = mocks.Stub(); + var importHandler = mocks.Stub(); + var exportHandler = mocks.Stub(); + var viewCommands = mocks.Stub(); + var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler, + importHandler, + exportHandler, + viewCommands, + context, + treeViewControl); + + var gui = mocks.Stub(); + gui.Stub(g => g.ViewCommands).Return(viewCommands); + gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl)) + { + // Then + TestHelper.AssertContextMenuStripContainsItem(contextMenu, + contextMenuAddCalculationIndexRootGroup, + "Berekening &toevoegen", + "Voeg een nieuwe berekening toe aan deze berekeningsmap.", + RingtoetsCommonFormsResources.FailureMechanismIcon); + } + } + } + + [Test] + public void GivenCalculationWithOutput_WhenClearingOutput_ThenClearOutput() + { + // Given + var observer = mocks.Stub(); + observer.Expect(o => o.UpdateObserver()); + + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + failureMechanism.WaveConditionsCalculationGroup.Attach(observer); + var assessmentSection = mocks.Stub(); + + var context = new StabilityStoneCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup, + failureMechanism, + assessmentSection); + + using (var treeViewControl = new TreeViewControl()) + { + var appFeatureCommandHandler = mocks.Stub(); + var importHandler = mocks.Stub(); + var exportHandler = mocks.Stub(); + var viewCommands = mocks.Stub(); + var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler, + importHandler, + exportHandler, + viewCommands, + context, + treeViewControl); + + var gui = mocks.Stub(); + gui.Stub(g => g.ViewCommands).Return(viewCommands); + gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl)) + { + // Precondition + TestHelper.AssertContextMenuStripContainsItem(contextMenu, + contextMenuAddCalculationIndexRootGroup, + "Berekening &toevoegen", + "Voeg een nieuwe berekening toe aan deze berekeningsmap.", + RingtoetsCommonFormsResources.FailureMechanismIcon); + + // When + ToolStripItem validateMeniItem = contextMenu.Items[contextMenuAddCalculationIndexRootGroup]; + validateMeniItem.PerformClick(); + + // Then + Assert.AreEqual(1, failureMechanism.WaveConditionsCalculationGroup.Children.Count); + Assert.IsInstanceOf(failureMechanism.WaveConditionsCalculationGroup.Children[0]); + // Check expectancies in TearDown() + } + } + } } } \ No newline at end of file