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

            handler.RegisterCommands(typeof(AllowSpacesTest2));
            Assert.AreEqual(1, handler.CommandList.Count);
        }
        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 TestErrorForNonexistentParseRule()
 {
     Assert.ThrowsException <CommandRegistrationException>(() => {
         var handler = new ExampleCommandHandler();
         handler.RegisterCommands(typeof(CallbackSyntaxTest0));
     });
 }
 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 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);
     });
 }
Example #14
0
 public void TestErrorIfInvalidParsingRule2()
 {
     Assert.ThrowsException <ParserInitializationException>(() =>
     {
         var handler = new ExampleCommandHandler();
         handler.AddParsingRules(typeof(InvalidParsingRules2 <User>));
     });
 }
Example #15
0
 public void TestErrorIfInvalidFlagRule4()
 {
     Assert.ThrowsException <ParserInitializationException>(() =>
     {
         var handler = new ExampleCommandHandler();
         handler.AddFlagRule(typeof(InvalidFlags3));
     });
 }
Example #16
0
 public void TestErrorIfInvalidFlagRule1()
 {
     Assert.ThrowsException <ArgumentNullException>(() =>
     {
         var handler = new ExampleCommandHandler();
         handler.AddFlagRule(null);
     });
 }
Example #17
0
 public void TestCommandHandlerInstantiation()
 {
     var handler = new ExampleCommandHandler();
     // No error
 }
 public ExampleCommandTests()
 {
     CommandHandler = new ExampleCommandHandler();
     CommandHandler.RegisterCommands("Example.Commands");
 }