I am new to testing and wondering how to write a functional test for uploading a file to Azure File Storage.
public async Task<ReturnObject> UploadFile(AzureObjectsResource azureObjectsResource) { var response = new ReturnObject(); AzureObjectsHelper.ValidateObjects(azureObjectsResource, response); if (response.Success) { try { object azureReturnResponse; using (var stream = new MemoryStream(azureObjectsResource.FileContent)) { object azureResponse = await azureObjectsResource.ShareFileClient.UploadAsync(stream); var azureResponseObject = (Response<ShareFileUploadInfo>)azureResponse; azureReturnResponse = azureResponseObject.Value; stream.Close(); } response.AzureResponseObject = azureReturnResponse; } catch (Exception ex) { response = new ReturnObject { Success = false, ErrorMessage = $"An exception was hit trying to upload the file. Message: {ex.Message}; Stack Trace: {ex.StackTrace}", AzureResponseObject = null }; } } return response; }