コード例 #1
0
        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)));
        }
コード例 #2
0
 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;
         }
     });
 }
コード例 #3
0
 public Interaction With(ProviderServiceRequest request)
 {
     Request = request;
     return(this);
 }
コード例 #4
0
ファイル: PactBuilder.cs プロジェクト: thonhotels/pactifier
 public PactBuilder With(ProviderServiceRequest request)
 {
     InteractionUnderConstruction =
         InteractionUnderConstruction.With(request);
     return(this);
 }