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); }
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); }
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); }
public void RemoveObjectThrowsExceptionOnNonExistingIdInObject() { var storage = new MetaDataStorage(this.engine, this.matcher); storage.RemoveObject(Mock.Of <IMappedObject>()); }
public void RemoveObjectThrowsExceptionOnNullArgument() { var storage = new MetaDataStorage(this.engine, this.matcher); storage.RemoveObject(null); }
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>())); }
public void RemoveObjectThrowsExceptionOnNullArgument([Values(true, false)] bool withValidation) { var storage = new MetaDataStorage(this.engine, this.matcher, withValidation); Assert.Throws <ArgumentNullException>(() => storage.RemoveObject(null)); }