Esempio n. 1
0
        public void TestMainMenuClick()
        {
            var assertableMenuAction = new AssertableMenuAction();
            var menuManager          = new MenuManager();

            menuManager.AddMenu(MenuLocation.MainMenu
                                + ("menu"
                                   + assertableMenuAction.Named("action1")
                                   + assertableMenuAction.Named("action2")
                                   + MenuItem.Separator
                                   + ("sub-menu"
                                      + assertableMenuAction.Named("sub-menu-action1")
                                      + assertableMenuAction.Named("sub-menu-action2")
                                      )
                                   + assertableMenuAction.Named("action3")));
            AddInContext context = CreateMainMenuContext();

            menuManager.GetMenuItems(context, null);
            menuManager.MenuClick(context, "-menu", "action1");
            menuManager.MenuClick(context, "-menu", "action2");
            menuManager.MenuClick(context, "-sub-menu", "sub-menu-action1");
            menuManager.MenuClick(context, "-sub-menu", "sub-menu-action2");
            menuManager.MenuClick(context, "-menu", "action3");
            Assert.AreEqual(new[] { "action1", "action2", "sub-menu-action1", "sub-menu-action2", "action3" }, assertableMenuAction.ExecutedActions);
        }
Esempio n. 2
0
        public void TestContextMenuClick()
        {
            var action      = new AssertableMenuAction();
            var menuManager = new MenuManager();

            menuManager.AddMenu(MenuLocation.TreeView +
                                ("VIENNAAddIn"
                                 + action.Named("Validate BDT Library")
                                 + action.Named("Create new BDT")))
            .ShowIf(ContextIsBDTLibrary);
            var context = CreatePackageContext(Stereotype.BDTLibrary);

            menuManager.GetMenuItems(context, null);
            menuManager.MenuClick(context, "-VIENNAAddIn", "Validate BDT Library");
            menuManager.MenuClick(context, "-VIENNAAddIn", "Create new BDT");
            Assert.AreEqual(new[] { "Validate BDT Library", "Create new BDT" }, action.ExecutedActions);
        }