Ejemplo n.º 1
0
 private void ValidateParameter(string value, string paramName)
 {
     if (value == null)
     {
         throw new ArgumentNullException(paramName, "Value can not be null.");
     }
     if (value == string.Empty)
     {
         throw new ArgumentException("An empty file name is invalid.", paramName);
     }
     if (value.Trim() == "")
     {
         throw new ArgumentException("The path has an invalid format.");
     }
     if (value.IndexOfAny(mockPath.GetInvalidPathChars()) > -1)
     {
         throw new ArgumentException("Illegal characters in path.", paramName);
     }
 }
Ejemplo n.º 2
0
 private void ValidateParameter(string value, string paramName)
 {
     if (value == null)
     {
         throw new ArgumentNullException(paramName, "File name cannot be null.");
     }
     if (value == string.Empty)
     {
         throw new ArgumentException("Empty file name is not legal.", paramName);
     }
     if (value.Trim() == "")
     {
         throw new ArgumentException("The path is not of a legal form.");
     }
     if (ExtractFileName(value).IndexOfAny(mockPath.GetInvalidFileNameChars()) > -1)
     {
         throw new NotSupportedException("The given path's format is not supported.");
     }
     if (ExtractFilePath(value).IndexOfAny(mockPath.GetInvalidPathChars()) > -1)
     {
         throw new ArgumentException("Illegal characters in path.");
     }
 }