public void AddDescendent() { FileSystemDirectory subdir = this.root.OfType <FileSystemDirectory>().First(); FileSystemFile newLeaf = FileSystemFile.Create("added.txt"); FileSystemDirectory updatedRoot = this.root.AddDescendent(newLeaf, subdir); Assert.Equal(this.root.Identity, updatedRoot.Identity); FileSystemDirectory updatedSubdir = updatedRoot.OfType <FileSystemDirectory>().First(); Assert.Contains(newLeaf, updatedSubdir); }
public void AddDescendentWithLookupTableFixup() { var root = this.GetRootWithLookupTable(); FileSystemDirectory subdir = root.OfType <FileSystemDirectory>().First(); FileSystemFile newLeaf = FileSystemFile.Create("added.txt"); FileSystemDirectory updatedRoot = root.AddDescendent(newLeaf, subdir); Assert.Equal(root.Identity, updatedRoot.Identity); FileSystemDirectory updatedSubdir = updatedRoot.OfType <FileSystemDirectory>().First(); Assert.Contains(newLeaf, updatedSubdir); }