mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
Running WireMock.Net without starting a server #289
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Code-Grump on GitHub (Aug 6, 2020).
Is there a way to run WireMock.Net without starting a server instance running on a physical port? It would be great to be able to create a server-less instance that exposes an
HttpMessageHandlerorHttpClientin a similar fashion to ASP.NET'sTestServer. It would be easy to inject these properties into a system-under-test to avoid having to go over a physical network link.@StefH commented on GitHub (Aug 6, 2020):
@Tragedian
I see your point, however WireMock.Net is created specifically (at this moment) to mock the wire and the requests and responses and can be used to mock 3rd party services.
@Code-Grump commented on GitHub (Aug 6, 2020):
I can see that the implementation is currently built around middleware configured using
WebHostBuilder. That makes it a relatively simple job to add the middleware to aTestServerinstance. PerhapsWireMockServercould be extended in some fashion to support any server capable of hosting the middleware?@StefH commented on GitHub (Aug 7, 2020):
Maybe making
WireMockMiddlewarepublic will already solve your question?@Code-Grump commented on GitHub (Aug 7, 2020):
It would be a fantastic step in that direction, certainly. The only challenge then would be configuring the middleware options, as those methods all exist on the server, not the options themselves. It probably wouldn't be hard to move some logic around to achieve that though.
@StefH commented on GitHub (Aug 13, 2020):
The middle ware depends on:
However code to add/configure mappings is not working because these methods are defined on the WireMock server code.
@StefH commented on GitHub (Oct 20, 2021):
Closing...