示例#1
0
        /// <summary>
        /// Creates a new <see cref="VirtualFile"/> instance that represents a file
        /// on a given file system.
        /// </summary>
        /// <param name="fileSystem">The file system to be used.</param>
        /// <param name="virtualFilePath">The qualified path (corresponding to
        /// <see cref="VirtualResourceInfo.FullName"/> that identifies the file on the
        /// file system.</param>
        /// <returns>A representation of the file on the file system.</returns>
        /// <exception cref="ArgumentNullException">If any of the parameters
        /// is a null reference.</exception>
        /// <exception cref="VirtualResourceNotFoundException">If the file cannot
        /// be found.</exception>
        /// <exception cref="ResourceAccessException">In case of invalid or prohibited
        /// resource access.</exception>
        public static VirtualFile Create(IFileSystemProvider fileSystem, string virtualFilePath)
        {
            if (fileSystem == null)
            {
                throw new ArgumentNullException("fileSystem");
            }
            if (virtualFilePath == null)
            {
                throw new ArgumentNullException("virtualFilePath");
            }

            var fileInfo = fileSystem.GetFileInfo(virtualFilePath);

            return(new VirtualFile(fileSystem, fileInfo));
        }
 public void Requesting_A_File_Name_Directly_Under_Root_Should_Cause_Exception()
 {
     var fileInfo = provider.GetFileInfo("Illegal");
 }