示例#1
0
 internal static void HandlerMustBeSet <TRunInfo>(CustomArgument <TRunInfo> argument,
                                                  int commandLevel) where TRunInfo : class
 {
     if (argument.Handler == null)
     {
         throw new CommandValidationException("Custom Argument is missing its handler callback.",
                                              CommandValidationError.NullCustomHandler, commandLevel);
     }
 }
示例#2
0
 internal static void CountMustBeGreaterThanZero <TRunInfo>(CustomArgument <TRunInfo> argument,
                                                            int commandLevel) where TRunInfo : class
 {
     if (argument.Count <= 0)
     {
         throw new CommandValidationException("Custom Argument has an invalid count. Must be greater than 0.",
                                              CommandValidationError.InvalidCount, commandLevel);
     }
 }
示例#3
0
 internal static List <Action <int> > Rules <TRunInfo>(CustomArgument <TRunInfo> argument)
     where TRunInfo : class
 {
     return(new List <Action <int> >
     {
         CountMustBeGreaterThanZero(argument),
         HandlerMustBeSet(argument)
     });
 }
示例#4
0
 private static Action <int> HandlerMustBeSet <TRunInfo>(CustomArgument <TRunInfo> argument)
     where TRunInfo : class
 {
     return(commandLevel =>
     {
         if (argument.Handler == null)
         {
             throw new CommandValidationException("Custom Argument is missing its handler callback.",
                                                  CommandValidationError.NullCustomHandler, commandLevel);
         }
     });
 }
示例#5
0
 private static Action <int> CountMustBeGreaterThanZero <TRunInfo>(CustomArgument <TRunInfo> argument)
     where TRunInfo : class
 {
     return(commandLevel =>
     {
         if (argument.Count <= 0)
         {
             throw new CommandValidationException("Custom Argument has an invalid count. Must be greater than 0.",
                                                  CommandValidationError.InvalidCount, commandLevel);
         }
     });
 }