NoppesTheFolf / E621Client

.NET Standard wrapper for the e621 API.
MIT License
9 stars 1 forks source link

Allow mocking of the E621Client to facilitate unit testing #11

Closed GizmoCaritate closed 3 years ago

GizmoCaritate commented 3 years ago

I ran into an issue when using your package to interact with the E621 API. I wanted to unit test the code that makes use of the E621Client

I have no real code examples to show but it boils down to this: Because of the builder / factory pattern the constructor of E621Client is set to internal because of which a mocking framework cannot create a mocked instance of the client.

It would be a possibility to solve this by creating a IE621Client interface that gets returned by the builder so that we can mock on that interface.

I will try to implement this and will link a PR to this issue when it's ready.

NoppesTheFolf commented 3 years ago

Thanks for bringing the issue to my attention! I did not anticipate this use case when I designed the library. Good luck ^^

GizmoCaritate commented 3 years ago

Change has been merged!