public void AncestryTest() { GenericRootFolder root = new GenericRootFolder("Foo", ContentModelMockObjectFactory.CreateObjectPersistor()); GenericFolder folder1 = new GenericFolder(root, "Folder1"); GenericFolder folder2 = new GenericFolder(root, "Folder2"); GenericFolder folder3 = new GenericFolder(folder2, "Folder3"); GenericDocument doc1 = new GenericDocument(folder1, "Doc1", "text/plain"); GenericDocument doc2 = new GenericDocument(folder3, "Doc2", "text/plain"); //The root folder is the ancestor of everyone Assert.IsTrue(root.IsAncestorOf(doc1)); Assert.IsTrue(root.IsAncestorOf(doc2)); //And everyone is the descendent of the root folder Assert.IsTrue(doc1.IsDescendentOf(root)); Assert.IsTrue(doc2.IsDescendentOf(root)); //doc1 is a descendent of folder1 Assert.IsTrue(doc1.IsDescendentOf(folder1)); Assert.IsFalse(doc1.IsDescendentOf(folder2)); Assert.IsFalse(doc1.IsDescendentOf(folder3)); //doc2 is a descendent of folder2 and folder3 Assert.IsFalse(doc2.IsDescendentOf(folder1)); Assert.IsTrue(doc2.IsDescendentOf(folder2)); Assert.IsTrue(doc2.IsDescendentOf(folder3)); }
public void GenericEmptyTest() { GenericDocument doc = new GenericDocument(_parent, "Foo", "text/plain"); Assert.AreEqual(1, _parent.Children.Count); Assert.IsTrue(doc.IsDescendentOf(_parent)); Assert.IsTrue(doc.IsDescendentOf(_root)); Assert.AreEqual("Foo", doc.Name); Assert.AreEqual("text/plain", doc.MimeType); Assert.AreEqual(_parent.Path + Path.DirectorySeparatorChar.ToString() + doc.Name, doc.Path); Assert.AreEqual(_parent, doc.Parent); Assert.AreEqual(_parent, doc.ParentFolder); Assert.AreEqual(_parent, doc.FileSystemParent); Assert.AreEqual(_root, doc.ParentFolder.RootFolder); }
public void NullIsDescendentTest() { GenericDocument doc = new GenericDocument(_parent, "Foo", "text/plain"); //Can't pass null to IsDescendentOf doc.IsDescendentOf(null); }