CmisSync.Lib.Storage.Database.FileTransmissionStorage.GetObjectByRemoteObjectId C# (CSharp) 메소드

GetObjectByRemoteObjectId() 공개 메소드

public GetObjectByRemoteObjectId ( string remoteObjectId ) : IFileTransmissionObject
remoteObjectId string
리턴 IFileTransmissionObject
        public IFileTransmissionObject GetObjectByRemoteObjectId(string remoteObjectId) {
            using (var tran = this.engine.GetTransaction()) {
                DbCustomSerializer<FileTransmissionObject> value = tran.Select<string, DbCustomSerializer<FileTransmissionObject>>(FileTransmissionObjectsTable, remoteObjectId).Value;
                if (value == null) {
                    return null;
                }

                return value.Get;
            }
        }

Usage Example

        public void SaveObjectBehaviorOverride() {
            var storage = new FileTransmissionStorage(this.engine);
            this.remoteFile.Setup(m => m.Id).Returns("RemoteObjectId");

            for (int i = 1; i <= 10; ++i) {
                var obj = new FileTransmissionObject(TransmissionType.UPLOAD_NEW_FILE, this.localFile.Object, this.remoteFile.Object);
                Assert.DoesNotThrow(() => storage.SaveObject(obj));
                Assert.That(storage.GetObjectList().Count, Is.EqualTo(1));
                Assert.That(storage.GetObjectList().First(foo => foo.LocalPath == this.localFile.Object.FullName && foo.RemoteObjectId == "RemoteObjectId"), Is.Not.Null);
                Assert.That(storage.GetObjectByRemoteObjectId("RemoteObjectId"), Is.Not.Null);
            }
        }