public void MoveNullTest()
 {
     //attempt to move to a null parent
     //That is not permitted
     GenericContentObject obj = new GenericContentObject(_doc);
     obj.Move(null);
 }
        public void GenericEmptyTest()
        {
            GenericContentObject obj = new GenericContentObject(_doc);

            Assert.AreEqual(1, _doc.Children.Count);
            Assert.AreEqual(_doc, obj.FileSystemParent);
        }
Esempio n. 3
0
        public void NonFsoChildTest()
        {
            GenericRootFolder root = new GenericRootFolder("Foo", ContentModelMockObjectFactory.CreateObjectPersistor());

            //Attempt to add a non-IFileSystemObject child
            GenericContentObject co = new GenericContentObject(root);
        }
 public void AddUnrelatedObjectTest()
 {
     //Add a content object to the container's Children list that
     //has a Parent other than the container
     GenericContentContainer contain = new GenericContentContainer(_doc);
     GenericContentObject notMine = new GenericContentObject(_doc);
     contain.Children.Add(notMine);
 }
 public void MoveBogusIdxTest()
 {
     //attempt to move to a bogus idx at a parent
     //That is not permitted
     GenericContentObject obj = new GenericContentObject(_doc);
     GenericDocument doc2 = new GenericDocument(_parent, "Doc1", "text/plain");
     obj.Move(doc2, 10);
 }
        public void AddItemTest()
        {
            GenericContentObject obj = new GenericContentObject(_cont);

            Assert.AreEqual(1, _cont.Children.Count);
            Assert.IsTrue(_cont.Children.Contains(obj));
            Assert.AreEqual(obj,  _cont.Children[0]);
            Assert.AreEqual(0, _cont.Children.IndexOf(obj));
        }
        public void CarveOutBadDestIdxTest()
        {
            //Pass an invalid index into the dest list
            GenericDocument doc2 = new GenericDocument(_parent,  "Baz",  "text/plain");
            GenericContentObject obj1 = new GenericContentObject(_cont);
            GenericContentObject obj2 = new GenericContentObject(_cont);
            GenericContentObject obj3 = new GenericContentObject(_cont);
            GenericContentObject obj4 = new GenericContentObject(_cont);

            _cont.Children.CarveOut(doc2,
                                    10,
                                    0,
                                    1);
        }
        public void AncestryTest()
        {
            GenericDocument doc1 = new GenericDocument(_parent, "Doc1", "text/plain");
            GenericDocument doc2 = new GenericDocument(_parent, "Doc2", "text/plain");
            GenericContentContainer contain = new GenericContentContainer(doc1);
            GenericContentObject obj = new GenericContentObject(contain);

            //The root folder is the ancestor of everyone
            Assert.IsTrue(_root.IsAncestorOf(contain.FileSystemParent));
            Assert.IsTrue(_root.IsAncestorOf(obj.FileSystemParent));

            //And everyone is the descendent of the root folder
            Assert.IsTrue(contain.FileSystemParent.IsDescendentOf(_root));
            Assert.IsTrue(obj.FileSystemParent.IsDescendentOf(_root));
        }
        public void CarveOutEntireListTest()
        {
            //Carve out the entire contents of the source list into the destination
            GenericDocument doc2 = new GenericDocument(_parent,  "Baz",  "text/plain");
            GenericContentObject obj1 = new GenericContentObject(_cont);
            GenericContentObject obj2 = new GenericContentObject(_cont);
            GenericContentObject obj3 = new GenericContentObject(_cont);
            GenericContentObject obj4 = new GenericContentObject(_cont);

            _cont.Children.CarveOut(doc2,
                                    0,
                                    0,
                                    _cont.Children.Count);

            Assert.AreEqual(0,  _cont.Children.Count);
            Assert.AreEqual(4,  doc2.Children.Count);
            foreach (IContentObject obj in doc2.Children) {
                Assert.AreEqual(doc2,  obj.Parent);
            }
        }
        public void RemoveItemTest()
        {
            GenericContentObject obj = new GenericContentObject(_cont);
            _cont.Children.Remove(obj);

            Assert.AreEqual(0, _cont.Children.Count);
            Assert.IsFalse(_cont.Children.Contains(obj));
        }
Esempio n. 11
0
        public void NonFsoChildTest()
        {
            GenericFolder folder = new GenericFolder(_root, "Bar");

            //Attempt to add a non-IFileSystemObject child
            GenericContentObject co = new GenericContentObject(folder);
        }
Esempio n. 12
0
        public void MoveTest()
        {
            GenericDocument doc1 = new GenericDocument(_parent, "Doc1", "text/plain");
            GenericDocument doc2 = new GenericDocument(_parent, "Doc2", "text/plain");
            GenericContentContainer contain = new GenericContentContainer(doc1);
            GenericContentObject obj = new GenericContentObject(contain);

            Assert.AreEqual(1, doc1.Children.Count);
            Assert.AreEqual(1, contain.Children.Count);
            Assert.AreEqual(0, doc2.Children.Count);

            Assert.AreEqual(contain, obj.Parent);
            Assert.AreEqual(doc1, obj.FileSystemParent);
            Assert.AreEqual(doc1, contain.Parent);

            //Move obj from doc1 to doc2
            contain.Move(doc2);
            Assert.AreEqual(0, doc1.Children.Count);
            Assert.AreEqual(1, doc2.Children.Count);

            Assert.AreEqual(contain, obj.Parent);
            Assert.AreEqual(doc2, obj.FileSystemParent);
            Assert.AreEqual(doc2, contain.Parent);
        }
Esempio n. 13
0
 public void NullParentTest()
 {
     GenericContentObject obj = new GenericContentObject(null);
 }