How can i mock CloudBlob.CopyState?
See original GitHub issueHi 👋
I’ve got some code that uploads a URL to a blob in the background, utilizing the following methods:
CloudBlob.StartCopyAsync
CloudBlob.FetchAttributesAsync
CloudBlob.CopyState
I’m trying to unit test my method that uses the above, and hence mock out the calls to Azure. The first two methods are virtual
so i can mock out fine, but the last one is a get
:
//
// Summary:
// Gets the state of the most recent or pending copy operation.
public CopyState CopyState { get; }
So during my test, CopyState.Status
will never be complete and will always be in it’s initial state.
Other than creating a wrapper class (which i always try and avoid), is there any other way i can mock out this method? For example: is there a way i can set some kind of state/property in the CloudBlob
class so that the CopyState.Status
will have a value of Success
?
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Mocking a CloudBlockBlob and have it return a stream
Those are two different streams. Grab the stream passed in the argument of the mock in a Callback and copy the test stream...
Read more >com.microsoft.azure.storage.blob.BlobProperties. ...
Returns the blob's copy state. * * @return A {@link CopyState} object that represents the copy state of the blob. */ public CopyState...
Read more >CloudBlob.CopyState Property - Storage
A CopyState object containing the copy state, or null if there is no copy state for the blob. Applies to. Product, Versions. Azure...
Read more >Class BlobsModelFactory | Azure SDK for Net
Class BlobsModelFactory. BlobsModelFactory provides utilities for mocking. ... BlobCopyInfo(ETag, DateTimeOffset, String, CopyStatus) ... BlobItem blob ...
Read more >CloudBlob.CopyState is null after direct account-to-account ...
This issue ended up being due to a logic error whereby blobs would be 'touched' resulting in the copy state being removed. The...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@erezvani1529 Heya 👋 Any chance this issue could be scheduled for resolution in a next-release plz?
Fixed in version 10.0.3.
Commit: https://github.com/Azure/azure-storage-net/commit/2b863c7e0d7d586e3c978576bb74c5125d70d059