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

            Assert.AreEqual(1, _doc.Children.Count);
            Assert.AreEqual(_doc, obj.FileSystemParent);
        }
Ejemplo 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);
 }
Ejemplo n.º 5
0
 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);
 }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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));
        }
Ejemplo n.º 9
0
        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);
            }
        }
Ejemplo n.º 10
0
        public void RemoveItemTest()
        {
            GenericContentObject obj = new GenericContentObject(_cont);
            _cont.Children.Remove(obj);

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

            //Attempt to add a non-IFileSystemObject child
            GenericContentObject co = new GenericContentObject(folder);
        }
Ejemplo 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);
        }
Ejemplo n.º 13
0
 public void NullParentTest()
 {
     GenericContentObject obj = new GenericContentObject(null);
 }