private static string UploadAvatarAndGetUuid(byte[] fileContentByte) { var customHeaders = new Dictionary <string, string> { { ApiClient.HEADER_ATTACHMENT_DESCRIPTION, AttachmentDescription }, { ApiClient.HEADER_CONTENT_TYPE, ContentType }, }; return(AttachmentPublic.Create(fileContentByte, customHeaders).Value); }
public void TestAttachmentUploadAndRetrieval() { var fileContentBytes = File.ReadAllBytes(PATH_ATTACHMENT + ATTACHMENT_PATH_IN); var customHeaders = new Dictionary <string, string> { { ApiClient.HEADER_CONTENT_TYPE, CONTENT_TYPE }, { ApiClient.HEADER_ATTACHMENT_DESCRIPTION, ATTACHMENT_DESCRIPTION } }; var attachmentUuid = AttachmentPublic.Create(API_CONTEXT, fileContentBytes, customHeaders).Value; var responseBytes = AttachmentPublicContent.List(API_CONTEXT, attachmentUuid).Value; Assert.Equal(fileContentBytes, responseBytes); }
public void TestAttachmentUploadAndRetrieval() { SetUpTestCase(); var fileContentBytes = File.ReadAllBytes(PathAttachment + AttachmentPathIn); var customHeaders = new Dictionary <string, string> { { ApiClient.HEADER_CONTENT_TYPE, ContentType }, { ApiClient.HEADER_ATTACHMENT_DESCRIPTION, AttachmentDescription } }; var attachmentUuid = AttachmentPublic.Create(fileContentBytes, customHeaders).Value; var responseBytes = AttachmentPublicContent.List(attachmentUuid).Value; Assert.Equal(fileContentBytes, responseBytes); }
public void Run() { var apiContext = ApiContext.Restore(); var customHeaders = new Dictionary <string, string> { { ApiClient.HEADER_CONTENT_TYPE, CONTENT_TYPE_IMAGE_JPEG }, { ApiClient.HEADER_ATTACHMENT_DESCRIPTION, DESCRIPTION_TEST_JPG_ATTACHMENT } }; var requestBytes = File.ReadAllBytes(PATH_ATTACHMENT_IN); var uuid = AttachmentPublic.Create(apiContext, requestBytes, customHeaders).Value; var responseBytes = AttachmentPublicContent.List(apiContext, uuid).Value; var fileOut = new FileInfo(PATH_ATTACHMENT_OUT); fileOut.Directory.Create(); File.WriteAllBytes(fileOut.FullName, responseBytes); }