示例#1
0
        public bool Match(List <string> paramNames)
        {
            // does the amount of required params meet the params we where expecting?
            if (paramNames.Count < ParametersToTake.Count(x => x.Value == ParameterType.Required))
            {
                return(false);
            }

            // check to see if we where expecing all the params which where passed in
            foreach (var param in paramNames.Where(x => !x.StartsWith("/")))
            {
                if (!ParametersToTake.ContainsKey(param))
                {
                    return(false);
                }
            }

            // check to see if all the required params where passed in
            foreach (var requiredParam in ParametersToTake.Where(x => x.Value == ParameterType.Required).Select(x => x.Key))
            {
                if (!paramNames.Contains(requiredParam))
                {
                    return(false);
                }
            }

            return(true);
        }
示例#2
0
 public int RequiredParametersCount()
 {
     return(ParametersToTake.Count(x => x.Value == ParameterType.Required));
 }
示例#3
0
 public List <string> GetParmaNames()
 {
     return(ParametersToTake.Select(x => x.Key).ToList());
 }