private void Given_server_configured_for_METHOD_URL_and_json_content_to_return_status_code <TContent>(HttpMethod method, string url, TContent content, HttpStatusCode code) { _server.Reconfigure(false, cfg => cfg.ForRequest(req => req.Method == method && req.RelativeUri == url && Equals(req.GetContentAsAnonymousJson(content), content)) .RespondStatusCode(code) .Apply()); }
private void Given_server_configured_for_METHOD_URL_and_body_to_return_status_code(HttpMethod method, string url, string body, HttpStatusCode code) { _server.Reconfigure(false, cfg => cfg.ForRequest(req => req.Method == method && req.RelativeUri == url && req.GetContentAsString() == body) .RespondStatusCode(code) .Apply()); }
private void Given_server_configured_for_METHOD_URL_with_headers_REQUESTHEADERS_and_json_content_REQUESTCONTENT_to_return_status_code_with_headers_RESPONSEHEADERS_and_json_content_RESPONSECONTENT <TRequestContent, TResponseContent>( HttpMethod method, string url, [FormatCollection] Dictionary <string, string> requestHeaders, [FormatJson] TRequestContent requestContent, HttpStatusCode code, [FormatCollection] Dictionary <string, string> responseHeaders, [FormatJson] TResponseContent responseContent) { _server.Reconfigure(false, cfg => cfg.ForRequest(req => req.Method == method && req.RelativeUri == url && requestHeaders.All(h => req.Headers.ContainsKey(h.Key) && req.Headers[h.Key] == h.Value) && Equals(req.GetContentAsAnonymousJson(requestContent), requestContent)) .Respond(rsp => rsp.SetStatusCode(code).SetHeaders(responseHeaders).SetJsonContent(responseContent)) .Apply()); }