最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

mocking - WireMock.Net 1.6.8 overides IHttpFactory.CreateClient()? - Stack Overflow

programmeradmin3浏览0评论

Note that I am a novice when it comes to programming.

I have an issue where I want to create an integration test for my service.

The service does several external API-calls. Which is why I wanted to use WireMock.Net to mock the responses.

Since I want to test the whole stack from controller and pass all the API-calls, I created an httpclient via my WebApplicationFactory. Reason for this is that I do not want to mock a response for the first API-call, only the external API-calls.

It works fine from here, but!

When I install the WireMock. the first httpclient fails with status 500. Eventhough I explicitly tells the WireMock.Net only to listen to a specific URL which is not used by my factory httpclient. This also is true if I remove all codes related to WireMock.Net.

So it feels like the NuGet package itself disrupts the standard httpclient?

Any suggestions on why this happens?

发布评论

评论列表(0)

  1. 暂无评论