Cannot mock the BlobBaseClient.CanGenerateSasUri property for testing #18224
Labels
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
needs-team-attention
Workflow: This issue needs attention from Azure service team or SDK team
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Service Attention
Workflow: This issue is responsible by Azure service team.
Storage
Storage Service (Queues, Blobs, Files)
When trying to unit test a class that provides SAS token URI's for blob access I'm struggling to be able to assert all of the necessary invocations on the BlobClient.
The following code example shows what I'm trying to do:
In my tests I want to ensure that the correct exception is thrown when "CanGenerateSasUri" evaluates to "false", and that the correct values are passed to "GenerateSasUri" when it evaluates to "true".
However, the source code shows that the "CanGenerateSasUri" property is not virtual, so it cannot be overridden by my mocking framework. However, ALL of the other public members of this class are marked as virtual except this one.
azure-sdk-for-net/sdk/storage/Azure.Storage.Blobs/src/BlobBaseClient.cs
Lines 176 to 180 in 430f2eb
So my question is two-fold...
The text was updated successfully, but these errors were encountered: