/// <summary> /// Adds a backend definition /// </summary> /// <param name="handler">The source handler</param> /// <param name="url">The URL (absolute or relative, may contain * wildcards) to match</param> /// <returns>The <see cref="T:MockedRequest"/> instance</returns> public static MockedRequest When(this MockHttpMessageHandler handler, string url) { var message = new MockedRequest(url); handler.AddBackendDefinition(message); return(message); }
/// <summary> /// Adds a backend definition /// </summary> /// <param name="handler">The source handler</param> /// <param name="method">The HTTP method to match</param> /// <param name="url">The URL (absolute or relative, may contain * wildcards) to match</param> /// <returns>The <see cref="T:MockedRequest"/> instance</returns> public static MockedRequest When(this MockHttpMessageHandler handler, HttpMethod method, string url) { var message = new MockedRequest(url); message.With(new MethodMatcher(method)); handler.AddBackendDefinition(message); return(message); }