Esempio n. 1
0
        public void RemoveDescendent()
        {
            FileSystemDirectory subdir          = this.root.OfType <FileSystemDirectory>().First(d => d.Children.OfType <FileSystemFile>().Any());
            FileSystemFile      fileUnderSubdir = subdir.Children.OfType <FileSystemFile>().First();
            FileSystemDirectory updatedRoot     = this.root.RemoveDescendent(fileUnderSubdir);

            Assert.Equal(this.root.Identity, updatedRoot.Identity);
            FileSystemDirectory updatedSubdir = (FileSystemDirectory)updatedRoot.Single(c => c.Identity == subdir.Identity);

            Assert.DoesNotContain(fileUnderSubdir, updatedSubdir);
        }
        public void RemoveDescendentWithLookupTableFixup()
        {
            var root = this.GetRootWithLookupTable();
            FileSystemDirectory subdir          = root.OfType <FileSystemDirectory>().First(d => d.Children.OfType <FileSystemFile>().Any());
            FileSystemFile      fileUnderSubdir = subdir.Children.OfType <FileSystemFile>().First();
            FileSystemDirectory updatedRoot     = root.RemoveDescendent(fileUnderSubdir);

            Assert.Equal(root.Identity, updatedRoot.Identity);
            FileSystemDirectory updatedSubdir = (FileSystemDirectory)updatedRoot.Single(c => c.Identity == subdir.Identity);

            Assert.False(updatedSubdir.Contains(fileUnderSubdir));
        }