Skip to content

Testability Issue #10309

Closed
Closed
@carbo-will

Description

@carbo-will

How would you write unit tests for a class that has HttpClient injected in its constructor (such as the CatalogService example above)? I would prefer if there were an interface (something called IHttpClient, or maybe IHttpMessageInvoker) that could be injected instead. Then providing a mock implementation for a unit test would be more straightforward.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions