-2

In my implementation code, I am fetching accountname from BlobServiceClient object. However when I try to mock it using MOQ, I see the error below. Is there a way to get around this error?

storageClientMock = new Mock<BlobServiceClient>();
storageClientMock.Setup(x => x.AccountName).Returns("accountname");

Message:  System.NotSupportedException : Unsupported expression: x => x.AccountName Non-overridable members (here: BlobServiceClient.get_AccountName) may not be used in setup / verification expressions.

Punter Vicky
  • 15,954
  • 56
  • 188
  • 315

1 Answers1

0

It's not a virtual method in a class afaik, so moq wont have the means to mock it. If there is no interface for this there is not much you can do using moq itself.

quain
  • 861
  • 5
  • 18