Azure / azure-data-lake-store-net

Azure Data Lake Store .Net SDK
MIT License
18 stars 24 forks source link

MockAdlsClient does not override async methods #11

Closed jeeshnair closed 6 years ago

jeeshnair commented 6 years ago

Hi,

Unless I am missing something obvious, it appears that mockAdlsClient only overrides and implements sync methods But not async variants. Is this by design? Or is it something which will be tackled in future?

rahuldutta90 commented 6 years ago

Oh MockAdlsClient is currently only used in powershell mock testing. This is only a memory store testing. We can have async methods also but what do you need this for @jeeshnair ? Generally for mock testing sync methods should suffice.

jeeshnair commented 6 years ago

Hi Rahul,

I built an instrumented client wrapping adlsclient with custom counters and telemetry. My instrumented client calls async methods. I am writing unit tests to test my instrumented client and I was hoping I could use mockAdlsClient. Without async methods overridden , my unit tests go through actual code path and not the inmemory implementation.

rahuldutta90 commented 6 years ago

okay I got it. I can make the changes in the next release.

However the mock adls client lacks few functionalities in mock testing. It does not fully mock server behavior (We currently do not have a good way to mock). So it wont be able to mock very complicated live unittests. Like for bulkupload/download we only do mock testing for a single file. For Acls it does not mock the full behavior of the server. So you have to test the mockadlsclient in a way it is designed to be. It is only testing the APIs.

As an alternative you can use moq to do that.

jeeshnair commented 6 years ago

Hi Rahul,

Yeah I understand a full blown mock capability is not possible. Thanks for taking care of this one.

rahuldutta90 commented 6 years ago

Fixed in the latest release.