public void MoveNonFolderTest() { //attempt to move to an object that isn't a folder //That is not permitted GenericDocument doc = new GenericDocument(_parent, "Foo", "text/plain"); GenericDocument doc2 = new GenericDocument(_parent, "Foo", "text/plain"); GenericContentContainer notMine = new GenericContentContainer(doc2); doc.Move(notMine); }
public void MoveTest() { 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"); Assert.AreEqual(2, root.Children.Count); Assert.AreEqual(1, folder1.Children.Count); Assert.AreEqual(1, folder2.Children.Count); Assert.AreEqual(1, folder3.Children.Count); Assert.AreEqual(root, folder1.ParentFolder); Assert.AreEqual(root, folder2.ParentFolder); Assert.AreEqual(folder2, folder3.ParentFolder); Assert.AreEqual(folder1, doc1.ParentFolder); Assert.AreEqual(folder3, doc2.ParentFolder); //Move doc2 from folder1 to folder2 Assert.AreEqual(Path.Combine(folder1.Path, doc1.Name), doc1.Path); doc1.Move(folder2); Assert.AreEqual(Path.Combine(folder2.Path, doc1.Name), doc1.Path); Assert.AreEqual(0, folder1.Children.Count); Assert.AreEqual(2, folder2.Children.Count); Assert.AreEqual(root, folder1.ParentFolder); Assert.AreEqual(root, folder2.ParentFolder); Assert.AreEqual(folder2, folder3.ParentFolder); Assert.AreEqual(folder2, doc1.ParentFolder); Assert.AreEqual(folder3, doc2.ParentFolder); }
public void MoveBogusIdxTest() { //attempt to move to a bogus idx at a parent //That is not permitted GenericDocument doc = new GenericDocument(_parent, "Foo", "text/plain"); GenericFolder folder2 = new GenericFolder(_parent, "Folder2"); doc.Move(folder2, 10); }
public void MoveNullTest() { //attempt to move to a null folder //That is not permitted GenericDocument doc = new GenericDocument(_parent, "Foo", "text/plain"); doc.Move(null); }