public void IsParentOfTest() { Assert.IsTrue(directoryA.IsParentOf(fileB)); Assert.IsTrue(directoryA.IsParentOf(directoryB)); Assert.IsTrue(root.IsParentOf(fileA)); Assert.IsTrue(root.IsParentOf(directoryA)); Assert.IsTrue(root.IsParentOf(fileB)); Assert.IsTrue(root.IsParentOf(directoryB)); Assert.IsFalse(fileB.IsParentOf(directoryA)); Assert.IsFalse(directoryB.IsParentOf(directoryA)); Assert.IsFalse(fileA.IsParentOf(root)); Assert.IsFalse(directoryA.IsParentOf(root)); Assert.IsFalse(fileB.IsParentOf(root)); Assert.IsFalse(directoryB.IsParentOf(root)); }
public void IsParentOfTest() { Assert.True(DirectoryA.IsParentOf(_fileB)); Assert.True(DirectoryA.IsParentOf(_directoryB)); Assert.True(_root.IsParentOf(_fileA)); Assert.True(_root.IsParentOf(DirectoryA)); Assert.True(_root.IsParentOf(_fileB)); Assert.True(_root.IsParentOf(_directoryB)); Assert.False(_fileB.IsParentOf(DirectoryA)); Assert.False(_directoryB.IsParentOf(DirectoryA)); Assert.False(_fileA.IsParentOf(_root)); Assert.False(DirectoryA.IsParentOf(_root)); Assert.False(_fileB.IsParentOf(_root)); Assert.False(_directoryB.IsParentOf(_root)); }
public ICollection <FileSystemPath> GetEntities(FileSystemPath path) { return(GetZipEntries() .Select(ToPath) .Where(entryPath => path.IsParentOf(entryPath)) .Select(entryPath => entryPath.ParentPath == path ? entryPath : path.AppendDirectory(entryPath.RemoveParent(path).GetDirectorySegments()[0])) .Distinct() .ToList()); }
public ICollection<FileSystemPath> GetEntities(FileSystemPath path) { return GetZipEntries() .Select(ToPath) .Where(entryPath => path.IsParentOf(entryPath)) .Select(entryPath => entryPath.ParentPath == path ? entryPath : path.AppendDirectory(entryPath.RemoveParent(path).GetDirectorySegments()[0]) ) .Distinct() .ToList(); }