Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r1141016ecbde1e84658f0a617eed864a547dd1ac -r776558d53b8a73cf16bdd5b50ff4d1eeff933b2f --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision 1141016ecbde1e84658f0a617eed864a547dd1ac) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision 776558d53b8a73cf16bdd5b50ff4d1eeff933b2f) @@ -26,6 +26,7 @@ using Core.Common.Base.Geometry; using Core.Common.Controls.TreeView; using Core.Common.Gui; +using Core.Common.Gui.Commands; using Core.Common.Gui.ContextMenu; using Core.Common.Gui.Forms.MainWindow; using Core.Common.Gui.TestUtil.ContextMenu; @@ -181,6 +182,7 @@ using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(cmp => cmp.Get(groupContext, treeViewControl)).Return(menuBuilderMock); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -203,12 +205,13 @@ assessmentSectionMock); var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - mocks.ReplayAll(); - using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(g => g.Get(groupContext, treeViewControl)).Return(menuBuilder); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); + mocks.ReplayAll(); + // Call ContextMenuStrip menu = info.ContextMenuStrip(groupContext, null, treeViewControl); @@ -371,6 +374,7 @@ using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -417,6 +421,7 @@ using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -463,6 +468,7 @@ using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -518,6 +524,7 @@ using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -556,6 +563,7 @@ using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -602,6 +610,7 @@ using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -648,6 +657,7 @@ using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -703,6 +713,7 @@ using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -765,6 +776,7 @@ { guiMock.Expect(g => g.Get(groupContext, treeViewControl)).Return(menuBuilder); guiMock.Expect(g => g.MainWindow).Return(mainWindowStub); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -847,6 +859,7 @@ using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(g => g.Get(groupContext, treeViewControl)).Return(menuBuilder); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -890,6 +903,7 @@ using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -934,6 +948,7 @@ using (var treeViewControl = new TreeViewControl()) { guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiMock.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub()); mocks.ReplayAll(); @@ -972,20 +987,23 @@ { Name = "Nieuwe berekening" }; + var viewCommandsMock = mocks.StrictMock(); + viewCommandsMock.Expect(vc => vc.RemoveAllViewsForItem(calculation)); + var observerMock = mocks.StrictMock(); observerMock.Expect(o => o.UpdateObserver()); using (var treeViewControl = new TreeViewControl()) { - var gui = mocks.StrictMock(); - gui.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); + guiMock.Stub(cmp => cmp.ViewCommands).Return(viewCommandsMock); mocks.ReplayAll(); group.Children.Add(calculation); nodeData.Attach(observerMock); - plugin.Gui = gui; + plugin.Gui = guiMock; DialogBoxHandler = (name, wnd) => {