cyberark / conjur-api-dotnet

.NET client for the CyberArk Conjur API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make httpClient field protected or public

montoner0 opened this issue · comments

Is your feature request related to a problem? Please describe.

Since httpClient is currently an internal field it makes unit testing and expanding the Client class significantly harder and involves vague techniques (e. g. to make possible HttpClient substitution with a mocked one I've changed RootNamespace property of my test project to Conjur).

Describe the solution you would like

Make httpClient field either protected, public or assignable from outside in some other way (e.g. parameter of constructor).

Additional context

Mocking HttpClient is essential in unit testing since we need predictable responses. In expanding of the Client class, accessing to an HttpClient instance also plays major role.

Another obstacle on the path of a happy unit-testing is ApiKeyAuthenticator.GetToken() method which creates its own HttpClient instance.