public void CheckAddCommandToTwoContexts()
        {
            var ctx1 = new MenuContext (string.Empty, string.Empty);
            var ctx2 = new MenuContext (string.Empty, string.Empty);

            var cmd = new MenuCommand (string.Empty, string.Empty);

            ctx1.AddCommand (cmd);
            ctx2.AddCommand (cmd);
        }
        public void Init()
        {
            this.driver = new MenuDriver ();

            var root_context = new MenuContext ("", "");
            root_context.AddCommand (new MenuCommand ("a", ""));
            root_context.AddCommand (new MenuCommand ("aaa", ""));
            root_context.AddCommand (new MenuCommand ("aab", ""));
            root_context.AddCommand (new MenuCommand ("ccc", ""));

            var context1 = new MenuContext ("context1",
                                            "",
                                            new MenuItemParameter ("param1", ""),
                                            new MenuItemParameter ("param2", ""));
            context1.AddCommand (new MenuCommand ("", ""));
            context1.AddCommand (new MenuCommand ("cmd", ""));

            var context2 = new MenuContext ("context2", "");
            context2.AddCommand (new MenuCommand ("cmd", ""));

            var context = new MenuContext ("context",
                                           "",
                                           new MenuItemParameter ("param1", ""),
                                           new MenuItemParameter ("param2", ""),
                                           new MenuItemParameter ("param3", ""));
            context.AddCommand (new MenuCommand ("cmd", ""));

            var context10 = new MenuContext ("context10", "", new MenuItemParameter ("param1", ""));
            context10.AddCommand (new MenuCommand ("cmd", ""));

            var sub_a = new MenuContext ("sub_A", "");
            sub_a.AddCommand (new MenuCommand ("command", ""));
            sub_a.AddCommand (new MenuCommand ("command1", ""));
            sub_a.AddCommand (new MenuCommand ("command2", ""));
            sub_a.AddCommand (new MenuCommand ("command12", ""));

            var sub_b = new MenuContext ("Sub_B", "");
            sub_b.AddCommand (new MenuCommand ("aaa", ""));
            sub_b.AddCommand (new MenuCommand ("bbb", ""));
            sub_b.AddCommand (new MenuCommand ("ccc", ""));

            var ctx = new MenuContext ("ctx", "", new MenuItemParameter ("param1", ""));
            ctx.AddCommand (new MenuCommand ("cmd", ""));

            var myctx = new MenuContext ("myctx",
                                         "",
                                         new MenuItemParameter ("param1", ""),
                                         new MenuItemParameter ("param2", ""),
                                         new MenuItemParameter ("param3", ""),
                                         new MenuItemParameter ("param4", ""));
            myctx.AddCommand (new MenuCommand ("cmd", ""));

            var context2__sub = new MenuContext ("sub", "", new MenuItemParameter ("param1", ""));

            var context__sub = new MenuContext ("sub", "", new MenuItemParameter ("param1", ""));
            context__sub.AddCommand (new MenuCommand ("cmd", ""));

            var sub_b__a = new MenuContext ("a", "");

            sub_b.AddSubContext (sub_b__a);
            context.AddSubContext (context__sub);
            context2.AddSubContext (context2__sub);
            context1.AddSubContext (sub_a);
            context1.AddSubContext (sub_b);
            context1.AddSubContext (ctx);
            context1.AddSubContext (myctx);
            root_context.AddSubContext (context);
            root_context.AddSubContext (context1);
            root_context.AddSubContext (context2);
            root_context.AddSubContext (context10);

            this.driver.SetRootContext (root_context);
        }
        public void CheckSetRootContext_NotRoot_ToRoot()
        {
            this.driver = new MenuDriver ();

            var root = new MenuContext ("root", "");
            root.AddCommand (new MenuCommand ("cmd-1", ""));
            root.AddCommand (new MenuCommand ("cmd-2", ""));

            var sub = new MenuContext ("sub", "");
            sub.AddCommand (new MenuCommand ("cmd", ""));

            root.AddSubContext (sub);
            this.driver.SetRootContext (sub);
            this.driver.ToRoot ();

            Assert.AreEqual (sub, this.driver.Current);
        }