private static void DisplayRequest(Action <string> output, ProviderServiceRequest r) { var message = @"Actual request was: Method: {0} Path: {1} Query: {2} Body: {3} Headers:{4}"; output(string.Format(message, r.Method, r.Path, r.Query, r.Body != null ? JsonConvert.SerializeObject(r.Body) : "", HeadersToDisplayString(r.Headers))); }
public Action Verify(FakeHttpHandler handler, ProviderServiceRequest r, RequestComparer comparer, Action <string> output) { return(() => { var requests = new List <HttpRequestMessage>(); try { A.CallTo(() => handler.SendAsync(A <HttpRequestMessage> .That.Matches(actual => comparer.Execute(r, actual)), A <CancellationToken> ._)) .MustHaveHappenedOnceExactly(); } catch (ExpectationException) { if (output != null && r != null) { DisplayRequest(output, r); } throw; } }); }
public Interaction With(ProviderServiceRequest request) { Request = request; return(this); }
public PactBuilder With(ProviderServiceRequest request) { InteractionUnderConstruction = InteractionUnderConstruction.With(request); return(this); }