Exemple #1
0
 public static HttpCallAssertion WithHeadersTest(this HttpCallAssertion assertion)
 {
     return(assertion
            .WithHeader("Accept", "*application/x.msgpacklz4; q=1.0*")
            .WithHeader("Accept", "*application/x-msgpack; q=0.75*")
            .WithHeader("Accept", "*application/json; q=0.5*"));
 }
 public static HttpCallAssertion WithExactBody(this HttpCallAssertion assert, string body)
 {
     return(assert.With(fc =>
     {
         fc.RequestBody.Should().Be(body);
         return true;
     }));
 }
Exemple #3
0
        public static HttpCallAssertion WithQueryParamMultiple <T>(this HttpCallAssertion assertion, string name, IEnumerable <T> collection)
        {
            foreach (var i in collection)
            {
                assertion = assertion.WithQueryParam(name, i);
            }

            return(assertion);
        }
 public static HttpCallAssertion WithJsonBody <TBody>(this HttpCallAssertion assertion, Func <TBody, bool> assert)
 {
     return(assertion
            .WithContentType("application/json")
            .With(call =>
     {
         var body = JsonConvert.DeserializeObject <TBody>(call.RequestBody);
         return assert(body);
     }));
 }
 public static HttpCallAssertion WithJsonPropertyMatching(this HttpCallAssertion a, Func <dynamic, string> propertyPicker, string regex) =>
 a.With(r => propertyPicker.Invoke(JObject.Parse(r.RequestBody)).Matches(new Regex(regex)));
 public static HttpCallAssertion WithJsonProperty <TProperty>(this HttpCallAssertion a, Func <dynamic, TProperty> propertyPicker, TProperty expected)
     where TProperty : IEquatable <TProperty> => a.With(r => ((TProperty)propertyPicker.Invoke(JObject.Parse(r.RequestBody))).Equals(expected));