public void CreateOpenItem_CanOpenView_CausesViewToOpenWhenClicked()
        {
            // Setup
            var commandHandler       = mocks.StrictMock <IApplicationFeatureCommands>();
            var importCommandHandler = mocks.StrictMock <IImportCommandHandler>();
            var exportCommandHandler = mocks.StrictMock <IExportCommandHandler>();
            var updateCommandHandler = mocks.StrictMock <IUpdateCommandHandler>();
            var viewCommands         = mocks.StrictMock <IViewCommands>();
            var nodeData             = new object();

            viewCommands.Expect(ch => ch.CanOpenViewFor(nodeData)).Return(true);
            viewCommands.Expect(ch => ch.OpenView(nodeData));

            mocks.ReplayAll();

            var contextMenuFactory = new GuiContextMenuItemFactory(commandHandler,
                                                                   importCommandHandler,
                                                                   exportCommandHandler,
                                                                   updateCommandHandler,
                                                                   viewCommands,
                                                                   nodeData);

            ToolStripItem item = contextMenuFactory.CreateOpenItem();

            // Call
            item.PerformClick();

            // Assert
            mocks.VerifyAll();
        }
        public void CreateOpenItem_Always_ItemWithPropertiesSet(bool canOpenView)
        {
            // Setup
            var commandHandler       = mocks.StrictMock <IApplicationFeatureCommands>();
            var importCommandHandler = mocks.StrictMock <IImportCommandHandler>();
            var exportCommandHandler = mocks.StrictMock <IExportCommandHandler>();
            var updateCommandHandler = mocks.StrictMock <IUpdateCommandHandler>();
            var viewCommands         = mocks.StrictMock <IViewCommands>();
            var nodeData             = new object();

            viewCommands.Expect(ch => ch.CanOpenViewFor(nodeData)).Return(canOpenView);

            mocks.ReplayAll();

            var contextMenuFactory = new GuiContextMenuItemFactory(commandHandler,
                                                                   importCommandHandler,
                                                                   exportCommandHandler,
                                                                   updateCommandHandler,
                                                                   viewCommands,
                                                                   nodeData);

            // Call
            ToolStripItem item = contextMenuFactory.CreateOpenItem();

            // Assert
            Assert.AreEqual("&Openen", item.Text);
            Assert.AreEqual("Open de gegevens in een nieuw documentvenster.", item.ToolTipText);
            TestHelper.AssertImagesAreEqual(Resources.OpenIcon, item.Image);
            Assert.AreEqual(canOpenView, item.Enabled);

            mocks.VerifyAll();
        }