public void TestAddCommands() { CommandInterpreter ci = new CommandInterpreter(DefaultCommands.None, new TestCommands()); Assert.AreEqual(2, ci.Options.Length); Assert.AreEqual("Other", ci.Options[0].DisplayName); Assert.AreEqual("SomeData", ci.Options[1].DisplayName); Assert.AreEqual(4, ci.Commands.Length); Assert.AreEqual("BlowUp", ci.Commands[0].DisplayName); Assert.AreEqual("Count", ci.Commands[1].DisplayName); // <= alpha-sorted Assert.AreEqual("ForXtoYbyZ", ci.Commands[2].DisplayName); Assert.AreEqual("Hidden", ci.Commands[3].DisplayName); foreach (ICommand c in ci.Commands) { ci.RemoveCommand(c); } Assert.AreEqual(0, ci.Commands.Length); ci = new CommandInterpreter(DefaultCommands.None); Assert.AreEqual(0, ci.Options.Length); Assert.AreEqual(0, ci.Commands.Length); ci.AddHandler(typeof(StaticTestFilter)); Assert.AreEqual(0, ci.Options.Length); // the type StaticTestFilter contains filters and no commands/options Assert.AreEqual(0, ci.Commands.Length); ci.AddHandler(new TestCommands()); Assert.AreEqual(2, ci.Options.Length); Assert.AreEqual(4, ci.Commands.Length); }