/// <summary> /// Downloads actual file data from Fortnox Archive into existing file object. Please note that the file object needs a valid file id. /// </summary> /// <param name="file">File object to be injected with file data.</param> public void DownloadFileData(File file) { if (file == null) { throw new ArgumentException("File must be set."); } if (string.IsNullOrEmpty(file.Id)) { throw new ArgumentException("File id must be set."); } Resource = "archive"; DownloadFile(file.Id, "", file); }
public void Test_File_Data_Upload_Download_Delete() { var connector = new ArchiveConnector(); // UPLOAD FILE DATA var uploadedFile = connector.UploadFileData(Resource.fortnox_image, "FortnoxImage.png", ""); MyAssert.HasNoError(connector); Assert.AreEqual("image/png", uploadedFile.ContentType); //DOWNLOAD FILE DATA var downloadedFile = new File() { Id = uploadedFile.Id }; connector.DownloadFileData(downloadedFile); Assert.AreEqual(Resource.fortnox_image.Length, downloadedFile.Data.Length); MyAssert.HasNoError(connector); //DELETE FILE connector.DeleteFile(uploadedFile.Id); MyAssert.HasNoError(connector); }