public void TestListVars() { CRegistery.Clear(); CVar a11 = new CVar("a11", "value"); CVar a12 = new CVar("a12", "value"); CVar b11 = new CVar("b11", "value"); CVar b12 = new CVar("b12", "value"); IList <CVar> vars = CRegistery.ListVars(); AssertList(vars, a11, a12, b11, b12); vars = CRegistery.ListVars("a"); AssertList(vars, a11, a12); vars = CRegistery.ListVars("a1"); AssertList(vars, a11, a12); vars = CRegistery.ListVars("a11"); AssertList(vars, a11); vars = CRegistery.ListVars("a13"); AssertList(vars); }
public void TestListCommands() { CRegistery.Clear(); CCommand a11 = new cmd_a11(); CCommand a12 = new cmd_a12(); CCommand b11 = new cmd_b11(); CCommand b12 = new cmd_b12(); CRegistery.Register(a11); CRegistery.Register(a12); CRegistery.Register(b11); CRegistery.Register(b12); IList <CCommand> commands = CRegistery.ListCommands(); AssertTypes(commands, typeof(cmd_a11), typeof(cmd_a12), typeof(cmd_b11), typeof(cmd_b12)); commands = CRegistery.ListCommands("a"); AssertTypes(commands, typeof(cmd_a11), typeof(cmd_a12)); commands = CRegistery.ListCommands("a1"); AssertTypes(commands, typeof(cmd_a11), typeof(cmd_a12)); commands = CRegistery.ListCommands("a11"); AssertTypes(commands, typeof(cmd_a11)); commands = CRegistery.ListCommands("a13"); AssertTypes(commands); }
protected virtual void Clear(bool deleteConfigs = true) { CBindings.Clear(); CRegistery.Clear(); if (deleteConfigs) { CConfigHelper.DeleteConfigs(); } }
public void TestRegisterMethodsCommands() { CRegistery.Clear(); Lunar.RegisterCommand("del1", Del1); Lunar.RegisterCommand("del2", Del2); Lunar.RegisterCommand("del3", Del3); IList <CCommand> cmds = CRegistery.ListCommands("del"); Assert.AreEqual(3, cmds.Count); Assert.AreEqual("del1", cmds[0].Name); Assert.AreEqual("del2", cmds[1].Name); Assert.AreEqual("del3", cmds[2].Name); }
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); }