Currently i am using “ManagementApiClient” from the SDK Auth0.ManagementApi, Version=6.5.5.0.
I am looking for an option to mock this class as part of my implementation but i couldn’t find any interface to mock it?
Is it possible to write the unit test the class which is having “ManagementApiClient” as dependency?
Hello,
I would change the approach a little bit. The main idea is to remove dependency from your app on “ManagementApiClient”. That coupling already creates problems for you.
Here is an example of what I would do:
Create interface in your app for functionality you need from “ManagementApiClient”. For example “IMyAppManagementApiClient”.
Implement that interface with new class which will wrap ManagementApiClient from Auth0 library.
Refactor instantiation and usage of ManagementApiClient. At that point everything should work the same way as before.
Create new Implementation of “IMyAppManagementApiClient” with MockManagementApiClient. in that new implementation you will be able to mock all properties.
Make a condition when you need create production instance of ManagementApiClient or mock instance for testing.