automoq and azure sdk CloudBlobClient mocking issue

52 views
Skip to first unread message

zai...@gmail.com

unread,
Nov 27, 2017, 5:37:19 PM11/27/17
to Autofac
Hello everyone.

This is the scenario I am trying to test.

I am trying to mock CloudBlobClient from https://www.nuget.org/packages/WindowsAzure.Storage/, however I am getting an error when using: Autofac.Extras.Moq (https://www.nuget.org/packages/Autofac.Extras.Moq). Not sure if this is the correct forum to post it. Please let me know if this is the correct place to post it or move it.


I uploaded my tests on: https://github.com/zaiboot/Automoq-AzureSdk.

Basically the class: [CloudBlobClient] has no empty constructor, so I used the parameters collection to load the required values as named parameter:
* Parameter[] p = { new NamedParameter("baseUri", uri) };
or a positional parameter:
* Parameter[] p = { new PositionalParameter(0, uri) };

However the class is not able to be created.

By using new Mock<CloudBlobClient>(uri); seems to be working fine. So I think because of a reason not clear to me the parameter is not being passed correctly. I just discovered this, so I haven't got the time to review the code on github.com. Will try that later once I get home.

Thanks and let me know if there is something I am doing wrong.
Reply all
Reply to author
Forward
0 new messages