Strugging to unit test code depending on CloudBlockBlob.GetSharedAccessSignature(...)
See original GitHub issueI noticed via #318 that many methods have been made virtual to allow for mocking. This has been immensely helpful in allowing unit testing of modules depending on this library. However, CloudBlockBlob.GetSharedAccessSignature(...)
does not have the virtual qualifier and I’m having difficulty working around this.
I don’t want to depend on the storage emulator for my unit tests, so in essence, anything that depends on a real connection could really do with being made virtual, starting with CloudBlockBlob.GetSharedAccessSignature(...)
. 😃
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Mocking a CloudBlockBlob and have it return a stream
I'm trying to Moq an Azure CloudBlockBlob and have it return a Stream so that I can test whether my BlobStorage repository is...
Read more >How to mock or unit test AzureStorageAccount with xunit
Hi, Want to unit test below code: CloudStorageAccount storageAccount = CloudStorageAccount.Parse("connString"); CloudBlobClient blobClient ...
Read more >Unit testing and mocking with Azure SDK .NET
For the latest guidance on unit testing and mocking, see Unit testing and ... How can you reliably test code with external dependencies?...
Read more >Introducing Asynchronous Cross-Account Copy Blob
We are excited to introduce some changes to the Copy Blob API with 2012-02-12 version that allows you to copy blobs between storage...
Read more >Symptom - Windows Azure – Troubleshooting & Debugging
This blog post will describe how to convert your older code based diagnostics configuration to the new WAD 1.2 XML based configuration model....
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
For reference my mock is now:
My tests that depend on
GetSharedAccessSignature
now work.You’re getting the NullReferenceException because your Mock<CloudBlockBlob> object’s Name property is null. You can fix this using the SetupGet() method, like so:
mockCloudBlockBlob.SetupGet(_ => _.Name).Returns(“testBlob”);