Beispiel #1
0
 /// <summary>
 /// Creates a <see cref="RequestMatcher"/> that expect the given request body content.
 /// </summary>
 /// <param name="body">The request body.</param>
 /// <returns>The request matcher.</returns>
 public static RequestMatcher MatchBody(string body)
 {
     return(delegate(IClientHttpRequest request)
     {
         MockClientHttpRequest mockRequest = request as MockClientHttpRequest;
         AssertionUtils.AreEqual(body, mockRequest.GetBodyAsString(), "Unexpected body content");
     });
 }
Beispiel #2
0
 /// <summary>
 /// Creates a <see cref="RequestMatcher"/> that expect to contain the given request body content.
 /// </summary>
 /// <param name="body">The substring that must appear in the body content.</param>
 /// <returns>The request matcher.</returns>
 public static RequestMatcher MatchBodyContains(string body)
 {
     return(delegate(IClientHttpRequest request)
     {
         MockClientHttpRequest mockRequest = request as MockClientHttpRequest;
         string actualBody = mockRequest.GetBodyAsString();
         AssertionUtils.IsTrue(actualBody.Contains(body), String.Format("Body didn't contain expected content [expected:<{0}> in:<{1}>]", body, actualBody));
     });
 }