Overwrite same endpoint with different result
Merhex opened this issue · 3 comments
Merhex commented
Hello,
Is it possible to return another result from the exact same endpoint without clearing the handler?
Regards,
Axel
richardszalay commented
Apologies for the delayed reply.
Have you tried using Expect (combined with BackendDefinitionBehavior.Always
if you have other requests)?
Timores commented
If you have the handler, you can simply call Respond again.
I use a helper method like this:
private MockedRequest _getSignature;
public void SetupGetSignature(OmsSignatureResult result)
{
_getSignature ??= _mockHttp.When(HttpMethod.Post, "/api/v1/signature");
_getSignature.Respond(request => SetupSignatureResponse(request, result));
}
richardszalay commented
I think between my answer and @Timores's, that should cover your question. Please open another issue if it doesn't.