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.Collapse(); _file = new FileInfo(_path.FullPath); }
public void CollapseRetainsProvider() { // Given FilePath filePath = new FilePath(new Uri("foo:///"), "/a/b/../c/bar.txt"); // When FilePath path = filePath.Collapse(); // Then Assert.AreEqual("/a/c/bar.txt", path.FullPath); Assert.AreEqual(new Uri("foo:///"), path.FileProvider); }
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 IFile GetFile(FilePath path) => new TestFile(this, path.Collapse().FullPath);
public TestFile(TestFileProvider fileProvider, FilePath path) { _fileProvider = fileProvider; _path = path.Collapse(); }