Closed cross-apps closed 5 years ago
Hi @cross-apps This is expected. You setup the server and then mock the request paths to it.
Yes but the server could be any url in my opinion. If I use a client for example there I can define a baseUrl which accepts a routing part as well.
Thanks @cross-apps I want to keep the server flexible so that it can handle multiple paths. The server can also be re-used between test fixtures. A TCP socket is an expensive resource, and it takes a while for the OS to release the port. This delays the next test. We keep the server alive, but use new mocks with the same server.
Hope this helps.
@hibri yeah this sounds great, thank you for your effort!
Hi,
I was wondering why my mock server didn't return the correct response till I noticed that an attached "/api" or sth. at the end of the base url did not work.
_testServer = HttpMockRepository.At("http://localhost:9011/api");
_testServer.Stub(s => s.Post("makeDonuts"))
changed into_testServer = HttpMockRepository.At("http://localhost:9011");
_testServer.Stub(s => s.Post("/api/makeDonuts"))