public IFile GetFile(FilePath path) { if (path == null) { throw new ArgumentNullException(nameof(path)); } return(GetFileProvider(path).GetFile(path.Collapse())); }
public void ShouldCollapse(string fullPath, string expected) { // Given FilePath filePath = new FilePath(fullPath); // When FilePath path = filePath.Collapse(); // Then Assert.AreEqual(expected, path.FullPath); }
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); }
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); }
public TestFile(TestFileProvider fileProvider, FilePath path) { _fileProvider = fileProvider; _path = path.Collapse(); }
public IFile GetFile(FilePath path) => new TestFile(this, path.Collapse().FullPath);