예제 #1
0
        public void RemoveObjectTest()
        {
            string remoteId = "remoteId";
            var    storage  = new MetaDataStorage(this.engine, this.matcher);
            var    obj      = new MappedObject("name", remoteId, MappedObjectType.Folder, null, null);

            storage.SaveMappedObject(obj);

            storage.RemoveObject(obj);

            Assert.That(storage.GetObjectByRemoteId(remoteId), Is.Null);
        }
예제 #2
0
        public void RemoveObjectDoesNotTouchParents()
        {
            string remoteId   = "remoteId";
            string childId    = "childId";
            string subChildId = "subchildId";
            var    storage    = new MetaDataStorage(this.engine, this.matcher);
            var    obj        = new MappedObject("name", remoteId, MappedObjectType.Folder, null, null);
            var    child      = new MappedObject("child", childId, MappedObjectType.Folder, remoteId, null);
            var    subchild   = new MappedObject("subchild", subChildId, MappedObjectType.File, childId, null);

            storage.SaveMappedObject(obj);
            storage.SaveMappedObject(child);
            storage.SaveMappedObject(subchild);

            storage.RemoveObject(child);

            Assert.That(storage.GetObjectByRemoteId(remoteId), Is.EqualTo(obj));
            Assert.That(storage.GetObjectByRemoteId(childId), Is.Null);
            Assert.That(storage.GetObjectByRemoteId(subChildId), Is.Null);
        }
예제 #3
0
        public void RemoveObjectRemovesChildrenAsWell([Values(true, false)] bool withValidation)
        {
            string remoteId   = "remoteId";
            string childId    = "childId";
            string subChildId = "subchildId";
            var    storage    = new MetaDataStorage(this.engine, this.matcher, withValidation);
            var    obj        = new MappedObject("name", remoteId, MappedObjectType.Folder, null, null);
            var    child      = new MappedObject("child", childId, MappedObjectType.Folder, remoteId, null);
            var    subchild   = new MappedObject("subchild", subChildId, MappedObjectType.File, childId, null);

            storage.SaveMappedObject(obj);
            storage.SaveMappedObject(child);
            storage.SaveMappedObject(subchild);

            storage.RemoveObject(obj);

            Assert.That(storage.GetObjectByRemoteId(remoteId), Is.Null);
            Assert.That(storage.GetObjectByRemoteId(childId), Is.Null);
            Assert.That(storage.GetObjectByRemoteId(subChildId), Is.Null);
        }
예제 #4
0
        public void RemoveObjectThrowsExceptionOnNonExistingIdInObject()
        {
            var storage = new MetaDataStorage(this.engine, this.matcher);

            storage.RemoveObject(Mock.Of <IMappedObject>());
        }
예제 #5
0
        public void RemoveObjectThrowsExceptionOnNullArgument()
        {
            var storage = new MetaDataStorage(this.engine, this.matcher);

            storage.RemoveObject(null);
        }
예제 #6
0
        public void RemoveObjectThrowsExceptionOnNonExistingIdInObject([Values(true, false)] bool withValidation)
        {
            var storage = new MetaDataStorage(this.engine, this.matcher, withValidation);

            Assert.Throws <ArgumentException>(() => storage.RemoveObject(Mock.Of <IMappedObject>()));
        }
예제 #7
0
        public void RemoveObjectThrowsExceptionOnNullArgument([Values(true, false)] bool withValidation)
        {
            var storage = new MetaDataStorage(this.engine, this.matcher, withValidation);

            Assert.Throws <ArgumentNullException>(() => storage.RemoveObject(null));
        }