This repository holds the sample code for my blog post about mocking the IHttpClientFactory
interface.
https://duongnt.com/mock-ihttpclientfactory
- Open the solution in Visual Studio.
- From the Test Explorer window, right click
MockIHttpClientFactoryDemoTests
and selectRun
. - You should see all tests pass.
- From the command line, enter the solution's folder.
- Execute the following command.
dotnet test
- You should see the following result.
Starting test execution, please wait... A total of 1 test files matched the specified pattern. Passed! - Failed: 0, Passed: 2, Skipped: 0, Total: 2, Duration: 10 ms - MockIHttpClientFactoryDemoTests.dll (netcoreapp3.1)