Skip to content
Discussion options

You must be logged in to vote

So this becomes

MockHttpHandler _handler = new MockHttpHandler();

var httpClientFactoryMock = IHttpClientFactory.Mock();
httpClientFactoryMock.CreateClient(Any()).Returns(() => new HttpClient(_handler, disposeHandler: false));

And then I can test invocations directly from the handler.

Thank you!

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
2 replies
@Lexy2
Comment options

@Lexy2
Comment options

Answer selected by Lexy2
Comment options

You must be logged in to vote
4 replies
@thomhurst
Comment options

@Lexy2
Comment options

@thomhurst
Comment options

@Lexy2
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants