Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Trouble testing with mocks around Blob stoarge #697

Open
@Hammatt

Description

@Hammatt

Hi,
I have an Azure function which I'm trying to test using mocks, using the moq library.
I have had lots of success with this library, but have recently been having issues around two different things:

  1. Issues around trying to mock the value of an ETag. Because the BlobProperties Properties are not virtual, they cannot be mocked
  2. Issues around trying to mock the value of CloudBlob.Container. Once again, because this property is not virtual.

Here's a sample error message I'm getting trying to mock this library:

System.NotSupportedException: Invalid setup on a non-virtual (overridable in VB) member: inBlob => inBlob.Properties

Is there any reason that these particular things are not virtual, while many other things are?
Or is there another better solution which you would suggest to trying to test around this azure storage library?

I see that there has been work done in this area in the past, #465

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions