public void AddingToChildren_ShouldSetParentOfChild()
 {
     var folder = CreateFolder("Foo");
     var file = new FileNode(_io.Object, "f1.txt");
     folder.Children.Add(file);
     Assert.AreEqual(folder, file.Parent);
 }
 public void AddingToChildren_ShouldMoveFilesInOtherFolders()
 {
     var folder = CreateFolder("Foo");
     var file = new FileNode(_io.Object, "f1.txt");
     folder.Children.Add(file);
     Assert.AreEqual("Foo\\f1.txt", file.Path);
 }
        public void RemovingChild_Should_UnsetParent()
        {
            var folder = CreateFolder("Foo");
            var f1 = new FileNode(_io.Object, "f1");
            folder.Children.Add(f1);

            Assert.AreSame(folder, f1.Parent);

            folder.Children.Remove(f1);

            Assert.IsNull(f1.Parent);
        }
        public void DeletingChild_Should_RemoveFromChildren()
        {
            var folder = CreateFolder("Foo");
            var f1 = new FileNode(_io.Object, "f1");
            var f2 = new FileNode(_io.Object, "f2");
            folder.Children.Add(f1);
            folder.Children.Add(f2);

            f1.Delete();

            Assert.AreEqual(1, folder.Children.Count);
            Assert.AreSame(f2,folder.Children[0]);
        }