예제 #1
0
        public IFile GetFile(FilePath path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            return(GetFileProvider(path).GetFile(path.Collapse()));
        }
예제 #2
0
            public void ShouldCollapse(string fullPath, string expected)
            {
                // Given
                FilePath filePath = new FilePath(fullPath);

                // When
                FilePath path = filePath.Collapse();

                // Then
                Assert.AreEqual(expected, path.FullPath);
            }
예제 #3
0
            public void CollapseRetainsProvider()
            {
                // Given
                FilePath filePath = new FilePath("foo", "/a/b/../c/bar.txt");

                // When
                FilePath path = filePath.Collapse();

                // Then
                Assert.AreEqual("/a/c/bar.txt", path.FullPath);
                Assert.AreEqual("foo", path.Provider);
            }
예제 #4
0
파일: LocalFile.cs 프로젝트: gep13/Wyam
        public LocalFile(FilePath path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }
            if (path.IsRelative)
            {
                throw new ArgumentException("Path must be absolute", nameof(path));
            }

            _path = path;
            _file = new FileInfo(path.Collapse().FullPath);
        }
예제 #5
0
 public TestFile(TestFileProvider fileProvider, FilePath path)
 {
     _fileProvider = fileProvider;
     _path         = path.Collapse();
 }
예제 #6
0
 public IFile GetFile(FilePath path) =>
 new TestFile(this, path.Collapse().FullPath);