Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running WireMock.Net without starting a server #498

Closed
Code-Grump opened this issue Aug 6, 2020 · 6 comments
Closed

Running WireMock.Net without starting a server #498

Code-Grump opened this issue Aug 6, 2020 · 6 comments
Labels

Comments

@Code-Grump
Copy link

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 HttpMessageHandler or HttpClient in a similar fashion to ASP.NET's TestServer. It would be easy to inject these properties into a system-under-test to avoid having to go over a physical network link.

@StefH
Copy link
Collaborator

StefH commented 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
Copy link
Author

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 a TestServer instance. Perhaps WireMockServer could be extended in some fashion to support any server capable of hosting the middleware?

@StefH
Copy link
Collaborator

StefH commented Aug 7, 2020

Maybe making WireMockMiddleware public will already solve your question?

@Code-Grump
Copy link
Author

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
Copy link
Collaborator

StefH commented Aug 13, 2020

The middle ware depends on:

  • IWireMockMiddlewareOptions options
  • IOwinRequestMapper requestMapper
  • IOwinResponseMapper responseMapper
  • IMappingMatcher mappingMatcher

However code to add/configure mappings is not working because these methods are defined on the WireMock server code.

@StefH
Copy link
Collaborator

StefH commented Oct 20, 2021

Closing...

@StefH StefH closed this as completed Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants