コード例 #1
0
        public void TestRegisterMethodsCommandsFromTheSameObject()
        {
            CRegistery.Clear();

            Dummy dummy = new Dummy();

            CommandAction <string[]> del1 = dummy.Execute;
            CommandAction <string[]> del2 = dummy.Execute2;

            Lunar.RegisterCommand("del1", del1);
            Lunar.RegisterCommand("del2", del2);

            IList <CCommand> cmds = CRegistery.ListCommands("del");

            Assert.AreEqual(2, cmds.Count);
            Assert.AreEqual(del1, (cmds[0] as CDelegateCommand).ActionDelegate);
            Assert.AreEqual(del2, (cmds[1] as CDelegateCommand).ActionDelegate);

            CRegistery.UnregisterAll(dummy);
            cmds = CRegistery.ListCommands("del");
            Assert.AreEqual(0, cmds.Count);
        }