Esempio n. 1
0
        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);
        }
Esempio n. 2
0
            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);
            }
Esempio n. 3
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);
            }
Esempio n. 4
0
 public IFile GetFile(FilePath path) =>
     new TestFile(this, path.Collapse().FullPath);
Esempio n. 5
0
 public TestFile(TestFileProvider fileProvider, FilePath path)
 {
     _fileProvider = fileProvider;
     _path = path.Collapse();
 }