public void TestSubcommandInNestedClassWithSingleCommand()
        {
            var handler = new ExampleCommandHandler();

            handler.RegisterCommands(typeof(SubcommandTest3));
            Assert.AreEqual(2, handler.CommandList.Count);
        }
 public void TestErrorIfDuplicateSubcommand()
 {
     Assert.ThrowsException <CommandRegistrationException>(() => {
         var handler = new ExampleCommandHandler();
         handler.RegisterCommands(typeof(SubcommandTest0));
     });
 }
        public void TestSubcommand()
        {
            var handler = new ExampleCommandHandler();

            handler.RegisterCommands(typeof(SubcommandTest1));
            Assert.AreEqual(1, handler.CommandList.Count);
        }
 public void TestErrorIfInvalidName()
 {
     Assert.ThrowsException <CommandRegistrationException>(() => {
         var handler = new ExampleCommandHandler();
         handler.RegisterCommands(typeof(InvalidNameTest));
     });
 }
 public void TestErrorIfDuplicateCommandWithAlias()
 {
     Assert.ThrowsException <CommandRegistrationException>(() => {
         var handler = new ExampleCommandHandler();
         handler.RegisterCommands(typeof(DuplicateTest1));
     });
 }
 public void TestErrorIfFlagsWithOptionalParameter()
 {
     Assert.ThrowsException <CommandRegistrationException>(() => {
         var handler = new ExampleCommandHandler();
         handler.RegisterCommands(typeof(FlagsTest2));
     });
 }
        public void TestAsyncCommands()
        {
            var handler = new ExampleCommandHandler();

            handler.RegisterCommands(typeof(AsyncTest));
            Assert.AreEqual(1, handler.CommandList.Count);
        }
        public void TestOptionalAllowSpaces()
        {
            var handler = new ExampleCommandHandler();

            handler.RegisterCommands(typeof(AllowSpacesTest2));
            Assert.AreEqual(1, handler.CommandList.Count);
        }
 public void TestErrorIfMultipleFlags()
 {
     Assert.ThrowsException <CommandRegistrationException>(() => {
         var handler = new ExampleCommandHandler();
         handler.RegisterCommands(typeof(FlagsTest0));
     });
 }
 public void TestErrorIfInvalidReturnType()
 {
     Assert.ThrowsException <CommandRegistrationException>(() => {
         var handler = new ExampleCommandHandler();
         handler.RegisterCommands(typeof(CallbackSyntaxTest1));
     });
 }
 public void TestErrorForNonexistentParseRule()
 {
     Assert.ThrowsException <CommandRegistrationException>(() => {
         var handler = new ExampleCommandHandler();
         handler.RegisterCommands(typeof(CallbackSyntaxTest0));
     });
 }
 public void TestErrorIfInvalidSubcommandStructure4()
 {
     Assert.ThrowsException <CommandRegistrationException>(() => {
         var handler = new ExampleCommandHandler();
         handler.RegisterCommands(typeof(SubcommandTest7));
     });
 }
 public void TestErrorIfNullArgument()
 {
     Assert.ThrowsException <ArgumentNullException>(() => {
         var handler = new ExampleCommandHandler();
         handler.RegisterCommands((Type)null);
     });
 }
예제 #14
0
 public ExampleCommandTests()
 {
     CommandHandler = new ExampleCommandHandler();
     CommandHandler.RegisterCommands("Example.Commands");
 }