public void Can_Create_File_From_CopyRef( ) { FileInfo localFile = null; string path = null; CopyRefResponse copyRef = null; try { localFile = FileFactory.MakeFile(extension: "txt"); var uploaded = this.dropboxClient.UploadFile(this.TestFolder + "/" + string.Format("TestFile{0:yyyyMMddhhmmss}-Copy_CopyRef.txt", DateTime.Now), File.OpenRead(localFile.Name)).Result; path = uploaded.Path; copyRef = this.dropboxClient.GetCopyRef(path).Result; } catch { Assert.Inconclusive("Couldn't make file"); } finally { File.Delete(localFile.FullName); } var copied = this.dropboxClient.CopyFromCopyRef(copyRef.Copy_Ref, path.Replace("TestFile", "CopyFile")).Result; Assert.IsNotNull(copied); try { var deletedOrg = this.dropboxClient.Delete(path).Result; var deletedCopy = this.dropboxClient.Delete(copied.Path).Result; } catch { Assert.Inconclusive("Couldn't clean up files"); } }
public String GetCopyRef(String file) { int haveTryCounter = 0; while (true) { try { CopyRefResponse cpy = this.client.GetCopyRef(file); return(cpy.Copy_Ref); } catch (DropboxException e) { haveTryCounter++; if (haveTryCounter >= this.RetryTimes) { return(String.Empty); } } } }