Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/WaveHeightLocationsGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r992c355c1d478deb33ac05e3a904bc3e206526b9 -rfe72a9ce77faa57ab2452107a369b5d3938d8fd5 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/WaveHeightLocationsGroupContextTreeNodeInfoTest.cs (.../WaveHeightLocationsGroupContextTreeNodeInfoTest.cs) (revision 992c355c1d478deb33ac05e3a904bc3e206526b9) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/WaveHeightLocationsGroupContextTreeNodeInfoTest.cs (.../WaveHeightLocationsGroupContextTreeNodeInfoTest.cs) (revision fe72a9ce77faa57ab2452107a369b5d3938d8fd5) @@ -23,6 +23,8 @@ using System.Linq; using Core.Common.Base; using Core.Common.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.ContextMenu; using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; @@ -52,7 +54,7 @@ Assert.IsNotNull(info.Text); Assert.IsNull(info.ForeColor); Assert.IsNotNull(info.Image); - Assert.IsNull(info.ContextMenuStrip); + Assert.IsNotNull(info.ContextMenuStrip); Assert.IsNull(info.EnsureVisibleOnCreate); Assert.IsNull(info.ExpandOnCreate); Assert.IsNotNull(info.ChildNodeObjects); @@ -104,6 +106,47 @@ } [Test] + public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.StrictMock(); + var menuBuilder = mockRepository.StrictMock(); + + using (mockRepository.Ordered()) + { + menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.Build()).Return(null); + } + + var nodeData = new WaveHeightLocationsGroupContext(new ObservableList(), + assessmentSection); + + using (var treeViewControl = new TreeViewControl()) + { + var gui = mockRepository.Stub(); + gui.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); + mockRepository.ReplayAll(); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(nodeData, null, treeViewControl); + } + } + + // Assert + mockRepository.VerifyAll(); + } + + [Test] public void ChildNodeObjects_Always_ReturnsChildrenOfData() { // Setup