コード例 #1
0
        public BaseFileProviderTests()
        {
            _mockFileSystem = new MockFileSystemWrapper(new Dictionary <string, MockFileData>
            {
                { DirectoryPath1, new MockDirectoryData() },
                { DirectoryPath2, new MockDirectoryData() },
                { FilePath1, new MockFileData("Testing is meh") },
                { FilePath2, new MockFileData("I hate testing") },
                { FilePath3, new MockFileData("Testing sucks") }
            });

            _fileProvider = new BaseFileProvider(_mockFileSystem);
        }
コード例 #2
0
        public IFileInfo GetFileInfo(string subpath)
        {
            subpath = subpath.Replace("\\", "/");

            if (!subpath.StartsWith(Root))
            {
                return(new NotFoundFileInfo(Path.GetFileName(subpath)));
            }

            subpath = subpath.Substring(Root.Length);

            return(BaseFileProvider.GetFileInfo(subpath));
        }
コード例 #3
0
        public IDirectoryContents GetDirectoryContents(string subpath)
        {
            subpath = subpath.Replace("\\", "/");

            if (!subpath.StartsWith(Root))
            {
                return(new NotFoundDirectoryContents());
            }

            subpath = subpath.Substring(Root.Length);

            return(BaseFileProvider.GetDirectoryContents(subpath));
        }
コード例 #4
0
        public IExpirationTrigger Watch(string filter)
        {
            var newFilter = Path.Combine(Root, filter);

            return(BaseFileProvider.Watch(newFilter));
        }