Esempio n. 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);
     }
 }
Esempio n. 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);
     }
 }
Esempio n. 3
0
 internal static List <Action <int> > Rules <TRunInfo>(CustomArgument <TRunInfo> argument)
     where TRunInfo : class
 {
     return(new List <Action <int> >
     {
         CountMustBeGreaterThanZero(argument),
         HandlerMustBeSet(argument)
     });
 }
Esempio n. 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);
         }
     });
 }
Esempio n. 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);
         }
     });
 }