private bool IsValid(string[] args)
 {
     return(BaseValidator.IsEmptyArr(args) &&
            BaseValidator.IsCorrectLength(args
                                          , InputDTO.CountParams) &&
            BaseValidator.DoesNotContainNull(args) &&
            BaseValidator.CanParseToInt64(args[0], false) &&
            BaseValidator.DoesContainEnum(args[1]
                                          , typeof(InputDTO.Algorithms)));
 }
Beispiel #2
0
        public static InputDTO Parse(string[] args)
        {
            if (BaseValidator.IsEmptyArr(args))
            {
                throw new NullReferenceException("Array of parameters is null"); //81
            }
            if (BaseValidator.IsCorrectLength(args, InputDTO.CountParams))
            {
                throw new ArgumentException(
                          "The number of parameters is incorrect. " +
                          "There must be: " + InputDTO.CountParams);
            }

            return(new InputDTO
            {
                Number = Int64.Parse(args[0]),
                Algorithm = (InputDTO.Algorithms)
                            Enum.Parse(typeof(InputDTO.Algorithms), args[1])
            });
        }